+ Reply to Thread
Results 1 to 7 of 7

.find using variables

  1. #1
    Registered User
    Join Date
    10-09-2012
    Location
    Derby, England
    MS-Off Ver
    Excel 2010
    Posts
    16

    .find using variables

    Hi all,

    I'm trying to run a macro that searches for a value in another workbook (wbk2) which could appear multiple times in different worksheets. Once found i want to copy the row the value is found on and paste to the source workbook (wbk1). I have split the code into modules. The first works fine, it lists all files in the source folder, the second opens the files one by one (loops through) and calls the search macro for each. The search macro is below.

    Please Login or Register  to view this content.
    I can't get past the
    Please Login or Register  to view this content.
    part. I get the object variable with block variable not set error. I've tried to wrap my brain round it and am failing, could any of you good people help explain this to me?

    Thanks

    Dan

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: .find using variables

    Because Ws is blank without holding any SHEET


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    10-09-2012
    Location
    Derby, England
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: .find using variables

    Ahh, thanks for your help. So do i need to do something like
    Please Login or Register  to view this content.
    bearing in mind i want to search the whole workbook? Any further advice would be much appreciated.

  4. #4
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: .find using variables

    You can't say sheets in one shot... Instead you have to loop through each sheet of that workbook like this...

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    10-09-2012
    Location
    Derby, England
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: .find using variables

    Brilliant, i will try this and let you know how i get on. Thanks for your patience with this self taught, intellectually limited and reluctant coder!

  6. #6
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: .find using variables

    But you need another loop may be a Do or Do while or Do Until loop to find all the matches before moving to the next sheet..

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    10-09-2012
    Location
    Derby, England
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: .find using variables

    Thanks a lot for your help, i'm getting a 'Do without Loop' error now but have learnt something new! I will do my best to work this out myself and report back next week with code if necessary.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Find Value By Two Variables
    By ofd2008 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-11-2014, 05:28 AM
  2. Find (Using Find) using variables with or without quotes
    By Rick_Stanich in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-03-2009, 09:14 AM
  3. To find the power ( i.e. ^ n) when you have other variables.
    By e4excel in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 03-14-2009, 02:09 PM
  4. Using Find with different variables
    By SOS in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-19-2008, 11:12 AM
  5. Using variables to make a date and using find method to find that.
    By KyWilde in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-21-2005, 05:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1