+ Reply to Thread
Results 1 to 4 of 4

using the .find method and getting adjacent cell data

  1. #1
    Forum Contributor
    Join Date
    06-02-2005
    Posts
    100

    using the .find method and getting adjacent cell data

    Hi all,

    So it's time I learn to use the .Find method to make my code tighter.

    Until now if I needed to find a cell's data (and its adjacent data) I've been using code in the format of (for the purpose of this example, you can assume all data in coulmn 1 is unique. Functioning as aprimary key using incremeting integers):

    Please Login or Register  to view this content.
    This worked fine for small projects with only a couple hundred rows of records even if it continued to execute after finding the desired data. But now I'm working with some datasheets with 20 thousand+ records. Looping like this is no longer an option.

    So I'm learning to use the .Find method. I've figured out how to get it to work for finding the data I've indicated, but I have no idea how to set the foundAdjacentData value using the .Find method in the following snipet. Is it even possible?

    Please Login or Register  to view this content.
    Also, I can't use the .select method to select the found cell (and the report on the address) because the application is using a selected cell from another worksheet to set the "someValue" variable value in this and other modules.

    Thanks in advance,

    -o
    Last edited by Ouka; 05-15-2009 at 01:57 PM. Reason: Solved

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

    Re: using the .find method and getting adjacent cell data

    This will return the value of the cell to the right of the found cell:
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    06-02-2005
    Posts
    100

    Re: using the .find method and getting adjacent cell data

    Thank you very much! I tweaked what you gave me and made it work in my app.

    Please Login or Register  to view this content.
    line is new to me. what is this saying exactly? Double negatives make head hurt =P

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

    Re: using the .find method and getting adjacent cell data

    Good.

    If the search value is not found then the range variable (rFind) is set to nothing and subsequent code will result in an error. So you proceed only on the proviso that something is found, i.e. it is not nothing.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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