Variable Value within Range

Hamid Osmanov 21 Reputation points
2022-07-14T19:13:37.99+00:00

Hello,

I am trying to create a dynamic range by adding value of variable within range but it doesn't work.

Dim LastRow as Long
LastRow = Sheet2.Range("F1"). Current.Rows.Count + 1

........
Range("F&"+LastRow+"").Select
........

Do I add variable correctly to the range?220858-img-20220714-2109522.jpg220846-img-20220714-211026.jpg

I'd really appreciate if someone reviews the screenshots and helps me to understand what I am doing wrong. I need to add the same variable value to the "Data!R1C1:R1000C2" range instead of static"1000"

Many thanks in advance.

Regards.

Microsoft 365 and Office | Development | Other
Developer technologies | Visual Basic for Applications
0 comments No comments
{count} votes

Answer accepted by question author
  1. Viorel 125.8K Reputation points
    2022-07-15T05:30:26.453+00:00

    Try this: Range("F" & LastRowDuplicates).Select.

    And this: "Data!R1C1:R" & someVariable & "C2".

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.