Reputation: 681
I am looking to use variables to find a range as well as then use those to activate a selection.
Here is the code I have:
Dim first As Integer
Dim Last As Integer
first = (ActiveCell.Row + 1)
Selection.End(xlDown).Select
Last = (ActiveCell.Row - 1)
Range(("J" & first) : ("J" & last)).Select
However, I am getting a syntax error on this in Excel VBA 2010.
Any suggestions.
Thanks,
Upvotes: 1
Views: 141
Reputation: 26
The Range syntax is Range("A1:B2") so you will need to modify your code to:
Dim first As Integer
Dim Last As Integer
first = (ActiveCell.Row + 1)
Selection.End(xlDown).Select
Last = (ActiveCell.Row - 1)
Range("J" & first & ":" & "J" & Last).Select
Upvotes: 1