+ Reply to Thread
Results 1 to 4 of 4

Skip Blank Cell and Go To Next Row

  1. #1
    Registered User
    Join Date
    08-22-2010
    Location
    Barre, VT
    MS-Off Ver
    Excel 2003
    Posts
    4

    Skip Blank Cell and Go To Next Row

    Hi:

    I am writing a macro that searches for a value within a particular cell. If there is nothing in that cell, I would like the macro to skip down to the next row and check that cell. If there is a value in that initial cell, the formula is setup to do a vlookup to pull info from another table. Does anyone know how to manipulate Excel so that the macro checks a cell for a value, and if no value, check the cell immediately below it? I can't quite get it to work.

    Thanks for any help you can offer!

  2. #2
    Registered User
    Join Date
    08-24-2010
    Location
    California
    MS-Off Ver
    Excel 2007, 2010
    Posts
    45

    Re: Skip Blank Cell and Go To Next Row

    Try this - assuming you're searching for values in Column A. You'll have to tell it how you want the search to end though (in this example endVal is 10000).

    dim i, endVal as integer
    dim searchVal as string ' this is the value you're looking for

    endVal = 10000
    Do while i <> endVal
    if ActiveSheet.Cells(i,1).value = searchVal then
    'add your lookup code here
    end if
    i = i + 1
    loop

  3. #3
    Registered User
    Join Date
    08-22-2010
    Location
    Barre, VT
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Skip Blank Cell and Go To Next Row

    If searching from C15:C30, how would this change the code? Sorry...I have very little VBA experience.

  4. #4
    Registered User
    Join Date
    08-24-2010
    Location
    California
    MS-Off Ver
    Excel 2007, 2010
    Posts
    45

    Re: Skip Blank Cell and Go To Next Row

    This should do. You'll need to add the vlookup formula to the if-then function.

    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)

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