+ Reply to Thread
Results 1 to 5 of 5

Code to check and match not working

  1. #1
    Registered User
    Join Date
    03-18-2011
    Location
    Dayton, ME, USA
    MS-Off Ver
    Excel 2004 for MAC 11.5.4
    Posts
    77

    Code to check and match not working

    Hi

    I have the following code that is supposed to check cell AC for "YES" , if that is correct then put data into AH:AT from the row immediately above it.

    What am I doing wrong?

    Thanks
    Jon

    Please Login or Register  to view this content.
    Last edited by endoskeleton; 05-25-2011 at 04:00 PM.

  2. #2
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Code to check and match not working

    What's the Rw variable? Shouldn't that be LR???
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

  3. #3
    Registered User
    Join Date
    03-18-2011
    Location
    Dayton, ME, USA
    MS-Off Ver
    Excel 2004 for MAC 11.5.4
    Posts
    77

    Re: Code to check and match not working

    Hi Dave

    I'm very new to VBA, but on a steep learning curve.

    I see what you mean but when I replace the Rw with LR, the macro runs but nothing happens.

    It seems like it is finding no instances of "YES" within col AC.

    The "YES" in Column AC is actually generated by a formula
    Please Login or Register  to view this content.
    and then copied down the column does that make a difference ?

    Cheers

    Jon

  4. #4
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Code to check and match not working

    Your code only looks at the last cell in Colum AC. If you want to look at every cell in the column, you have to loop through each of them:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    03-18-2011
    Location
    Dayton, ME, USA
    MS-Off Ver
    Excel 2004 for MAC 11.5.4
    Posts
    77

    Re: Code to check and match not working

    Hi Dave,

    Ahh I see,.

    Didn't work the way at wanted at first until I realized that is was actually overwriting where I already had data. Once I changed the destination range it worked like a dream.

    Thanks so much for your help.

    Jon

+ 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