+ Reply to Thread
Results 1 to 3 of 3

Match Description - Macro stops if a cell in column is blank

  1. #1
    Forum Contributor geliedee's Avatar
    Join Date
    10-14-2013
    Location
    Manila, philippines
    MS-Off Ver
    Excel 2007
    Posts
    399

    Match Description - Macro stops if a cell in column is blank

    Hi All,

    I have a file which will look for the corresponding description in another sheet.
    its completely working if columns AF, AG and AH is completely populated. However, if the last cell in any column AF, AG and AH is blank, the macro stops working on the rows that has data.

    Capture.JPG

    Can anyone help me to alter the codes? I need to get the codes running even though it has blanks. I have also attached the file.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: Match Description - Macro stops if a cell in column is blank

    Hello,
    If I understand well, the problem is because you are finding the last row in column AF only. You also need to look at AG and AH.
    So try this instead :

    Please Login or Register  to view this content.
    Note in red, what I added. You must always reference to the sheet when working with rows, range or columns. Otherwise you could get bad results if for example you execute your macro from an other sheet.

    An other note: always explicitely declare your variable like this. Otherwise they are defined as VARIANT and again this can create problems. Even if you put them on the same line, Excel treats them as Variant.

    Please Login or Register  to view this content.
    GC Excel

    If this post helps, then click the star icon (*) in the bottom left-hand corner of my post to Add reputation.

  3. #3
    Forum Contributor geliedee's Avatar
    Join Date
    10-14-2013
    Location
    Manila, philippines
    MS-Off Ver
    Excel 2007
    Posts
    399

    Re: Match Description - Macro stops if a cell in column is blank

    Hi GC Excel, thank you for the explanation. Its very useful to me to understand it well. Thanks again. I have tried the code and perfectly working.

+ 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. [SOLVED] Return blank cell for formula is there's a match in a column?
    By djarcadian in forum Excel General
    Replies: 3
    Last Post: 02-18-2015, 10:54 AM
  2. Delete Row Macro stops at blank cell
    By ARLHigbee in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-22-2014, 03:47 PM
  3. Replies: 0
    Last Post: 09-21-2013, 09:03 PM
  4. Deleting Rows of Data that does not match certain column's description
    By exlgh91 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 05-14-2013, 12:27 PM
  5. Every 4th cell is blank and stops my macro!
    By Sandeman in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-17-2006, 12:10 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