+ Reply to Thread
Results 1 to 3 of 3

Select range between 2 different 'lastrows'

  1. #1
    Registered User
    Join Date
    03-05-2020
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    17

    Question Select range between 2 different 'lastrows'

    Hello,

    I have been learning about vba a bit recently, and now I am trying to select a range between 'lastrow' and 'lastrow2' so I can enter a formula in that selected range.
    Say Range("A1:A100") has values and Range("M1:M80") has values. I would like to enter a formula in Range("AA81:AA" & Lastrow)

    Since selecting the range to the last row is done by using " Range("AA1:AA" & Lastrow). ", I tried replicating that Lastrow part in the first section of the range defining as well.
    I tried using the following pieces of code, but it's giving me errors with the ':' part.

    Please Login or Register  to view this content.
    How can I write the last line so it selects the range between these two lastrows? I'm clueless at this point.

    Thanks in advance!

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Select range between 2 different 'lastrows'

    Hello,

    as the correct syntax is Range("AA" & Lastrow2 + 1 & ":AA" & Lastrow).Formula =

  3. #3
    Registered User
    Join Date
    03-05-2020
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    17

    Re: Select range between 2 different 'lastrows'

    Hi Marc,

    That works perfectly, thank you very much!

+ 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] SUMIFS Test on multiple lastrows
    By Roshan.Shakya in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-02-2019, 11:02 AM
  2. Make 'ActiveSheet.Range("C5:N100").Select' - select a dynamic range of cells
    By white_ross in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-13-2016, 10:00 AM
  3. Select range using .End(xldown).Row.select
    By forrestgump1980 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-18-2015, 07:12 AM
  4. .select method with worksheets object ex. Sheets("Sheet1").range.select fail
    By RobCan in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 12-19-2014, 07:01 PM
  5. Newbie: Auto Select/un-Select an Range of Slicer Items
    By luckyali in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-23-2014, 09:52 AM
  6. Replies: 4
    Last Post: 06-17-2013, 05:21 AM
  7. send to range, popup box to input what the range should be each time/select range
    By lax2734 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-26-2012, 01:37 AM

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