+ Reply to Thread
Results 1 to 7 of 7

Using the Find Function and Multiple Offset Columns

  1. #1
    Registered User
    Join Date
    09-05-2011
    Location
    St. John's, Canada
    MS-Off Ver
    Excel 2010
    Posts
    70

    Using the Find Function and Multiple Offset Columns

    Hey Everyone,

    I'm kinda of new to VB and you have all been so helpful. Currently I've been spending the paste little while writing a VB Excel Code that will search a worksheet for specific text ("cat") , once it finds the location of said text it copies the next cell over [Offset(, 1)] into another worksheet (Sheet2). Anywho in my actual code once I find the row I'm looking for I have to copy several columns from that row. So, I'm just curious is there a more efficient way to do this than to use the "Find" function every time? I mean I already know the row I'm looking for, so should I do the entire line of code again just to change the offset to (, 2). and again and again?

    Below is the sample code I'm working with

    Please Login or Register  to view this content.
    Thanks again everyone for your help!
    Last edited by ashleys.nl; 09-13-2011 at 12:14 PM. Reason: Solved

  2. #2
    Registered User
    Join Date
    09-05-2011
    Location
    St. John's, Canada
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: Using the Find Function and Multiple Offset Columns

    Also, how do I look through the whole worksheet not just after the ActiveCell?

    Thanks again

  3. #3
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Using the Find Function and Multiple Offset Columns

    A better way is to assign a range variable to the Find and then you can also check the value is found and avoid an error if not:
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    09-05-2011
    Location
    St. John's, Canada
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: Using the Find Function and Multiple Offset Columns

    Hey Stephen,

    That worked great, except I had to change "rfind.Offset...." to "r.Offset". "rfind" wasn't an object. But other than that it works great! thank you soo much for all your help lately. Below is the code I'm using now for others to see.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    09-05-2011
    Location
    St. John's, Canada
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: Using the Find Function and Multiple Offset Columns

    Hey, Just when I think I have something solved I have more work to do....

    So when I try to implement this into my master work book, I realize that my search term "Cat" appears 3 times and at each occurance there is useful information in that row that I want to take away. Is there a way to implement the code so that I could have multiple "r" values of "r1", "r2", and "r3"? Each value of course refering to their respective order of occurence.

    Thanks again in advance

  6. #6
    Registered User
    Join Date
    09-05-2011
    Location
    St. John's, Canada
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: Using the Find Function and Multiple Offset Columns

    Quote Originally Posted by ashleys.nl View Post
    Hey, Just when I think I have something solved I have more work to do....

    So when I try to implement this into my master work book, I realize that my search term "Cat" appears 3 times and at each occurance there is useful information in that row that I want to take away. Is there a way to implement the code so that I could have multiple "r" values of "r1", "r2", and "r3"? Each value of course refering to their respective order of occurence.

    Thanks again in advance
    Currently I'm using this code , but with no luck. It finds the first occurence of "cat" twice rather than moving on to the next.

    any thoughts???

    Please Login or Register  to view this content.

  7. #7
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Using the Find Function and Multiple Offset Columns

    Try this:
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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