+ Reply to Thread
Results 1 to 6 of 6

Dynamic Range question

  1. #1
    Registered User
    Join Date
    07-20-2012
    Location
    Pheonix
    MS-Off Ver
    Excel 2007
    Posts
    9

    Dynamic Range question

    I have recorded this code, but need the range to vary by the number of rows in the worksheet.

    How do I rewrite this?

    Please Login or Register  to view this content.
    Last edited by Cutter; 07-22-2012 at 03:35 PM. Reason: Added code tags

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,936

    Re: Dynamic Range question

    To get the row number last used row in a column use:
    Please Login or Register  to view this content.
    Replace the ? with the Column Letter.
    Last edited by Cutter; 07-22-2012 at 03:35 PM. Reason: Added code tags
    Ben Van Johnson

  3. #3
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: Dynamic Range question

    I know Ben has already posted but I had already typed the code so I might as well post it. It gives the end result that your code had but I am a bit puzzled what you intended with the AA2 part of
    Range("AA2:AE2").Select
    Please Login or Register  to view this content.
    or

    Please Login or Register  to view this content.
    Last edited by WasWodge; 07-22-2012 at 03:34 PM.
    If my solution worked (or not) please let me know. If your question is answered then please remember to mark it solved

    Computers are like air conditioners. They work fine until you start opening windows. ~Author Unknown

  4. #4
    Registered User
    Join Date
    07-20-2012
    Location
    Pheonix
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Dynamic Range question

    Thanks all! I sure all of these will work great.

    P.S. Column AA was the first uninterrupted column that got me to the bottom of the list without stopping between blank cells or to the bottom of the sheet.

  5. #5
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: Dynamic Range question

    That explains it. Please note only use the first code I posted if AE2 is a value and not a formula. You do also have the option of autofill which would be

    Please Login or Register  to view this content.
    Depends what suits best

  6. #6
    Registered User
    Join Date
    07-20-2012
    Location
    Pheonix
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Dynamic Range question

    Thanks WasWodge!

+ 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