+ Reply to Thread
Results 1 to 5 of 5

How to find row number of a Defined Name's cell?

  1. #1
    Registered User
    Join Date
    02-20-2012
    Location
    Chicago, Illinois
    MS-Off Ver
    Excel 2010
    Posts
    25

    How to find row number of a Defined Name's cell?

    I have a spreadsheet that has a cell with a Defined Name, let's call it MyName. How can I set a variable that contains the Row number of the cell called MyName?

    I'm relatively new to Excel VBA, though I'm an experienced scripter. I already have a Excel VBA script that does some useful work. I just need to find the row where this Name cell exists, as I can't be sure that rows haven't been added or deleted above this row.

    Thanks in advance.
    Last edited by btmtdk; 02-26-2012 at 01:11 PM.

  2. #2
    Valued Forum Contributor gjlindn's Avatar
    Join Date
    08-01-2011
    Location
    Dodgeville, WI
    MS-Off Ver
    Excel 2003, 2007, 2010, 2013
    Posts
    369

    Re: How to find row number of a Defined Name's cell?

    Hi btmtdk. Welcome to the forum! In VBA
    Please Login or Register  to view this content.
    Or
    Please Login or Register  to view this content.
    If it's not a workbook name, but a sheet name you'd need to append the worksheet to the range using either Sheets("sheetname") or the sheet object.
    Please Login or Register  to view this content.
    -Greg If this is helpful, pls click Star icon in lower left corner

  3. #3
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: How to find row number of a Defined Name's cell?

    Assuming CW1 is spare cell, you can use this code to store present row nmber of Myname cell in variable A.

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    02-20-2012
    Location
    Chicago, Illinois
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: How to find row number of a Defined Name's cell?

    Thank you GJ and KV.... Just what I needed! Late a night, my tired brain was searching through the textbooks without success. Then I thought, I bet the ExcelForum folks can help! What a great idea! Thanks so much!

    I can't figure out how to flag this post a Solved, but y'all helped me solve my issue!
    Last edited by btmtdk; 02-21-2012 at 01:40 PM.

  5. #5
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: How to find row number of a Defined Name's cell?

    Hi btmtdk

    To mark your thread solved do the following:
    - Go to your first post on the thread
    - Click edit
    - Click Advance
    - Just below the word "Title:" you will see a dropdown with the word No prefix.
    - Change to Solved
    - Click Save
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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