+ Reply to Thread
Results 1 to 9 of 9

VB Code to Find Row Number

  1. #1
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    VB Code to Find Row Number

    Hello:

    Please refer to attached file.
    I have data in column A thru column D as shown.
    As you go down the data, you will see #NUM &#REF!
    I need VB Code to give me the row # until the data is good.
    In this case it will be "219"

    Let me know if you have any questions.
    Thanks.
    Riz
    Attached Files Attached Files

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: VB Code to Find Row Number

    You can use the IsError boolean to check if each cell contains an error.

    Please Login or Register  to view this content.
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  3. #3
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: VB Code to Find Row Number

    If the error are not driven from a formula.

    Please Login or Register  to view this content.

  4. #4
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB Code to Find Row Number

    Hi Daf & AB33:

    Ok seems to work.
    Now i want to use the row # which is arrived from your code into below statement
    Please Login or Register  to view this content.
    My Data starts at A110 and upto column D across and down until the row calculated above.
    Currently it ask me to verify the range.
    I do not wish to verify the range.

    Please let me know if you have any questions.
    Thanks.

    Riz

  5. #5
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: VB Code to Find Row Number

    My code works with any range in columns A-D, regardless where the row starts. You can remove the message box and you can still get the same result as your code.
    You can either lines in your code.
    Please Login or Register  to view this content.
    Last edited by AB33; 11-25-2015 at 06:52 PM.

  6. #6
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB Code to Find Row Number

    Hi AB33:

    I have tried your suggestion but it gets error at above code.
    Riz

  7. #7
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB Code to Find Row Number

    Hi Guys:

    Have a look at attached sheet and run the macro to understand my problem.
    Please let me know if you have any questions.
    Thanks.

    Riz
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: VB Code to Find Row Number

    Yes you will get an error as a row is not an object(Range). You can not set to a row, but only to an object. If you want to remove the selection and want to return a row number, use this line. If you still want to keep the selection box, use RowNumber1. Both lines gives the same result.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Last edited by AB33; 11-26-2015 at 10:16 AM.

  9. #9
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB Code to Find Row Number

    Hi AB33:

    I believe i got it, will test more and let you know if any issues or help needed.
    Thanks a lot.
    Riz

+ 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. Find page number of cell - speed up code
    By ChrisPatterson in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-17-2015, 10:14 AM
  2. [SOLVED] Using MATCH within VBA to find a row number used elsewhere in code
    By jacob@thepenpoint in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-31-2013, 11:01 AM
  3. [SOLVED] Code to find value and divide by defined number
    By narrowgate88 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-24-2013, 09:29 AM
  4. [SOLVED] vba code to find last row value, add new row and auto number new row
    By kawa13 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-13-2013, 06:16 AM
  5. [SOLVED] Find out the reference number for a column for VBA code
    By Jiptastic in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-09-2012, 05:27 PM
  6. Need a VB Code to find the max number in a list
    By adaws in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-07-2012, 10:04 PM
  7. Replies: 3
    Last Post: 11-03-2005, 02:30 AM

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