Reputation: 1
Ok, I'm sure this question is really basic but all my searchers turn up complicated answers and I've been messing with VBA for about a day. I have two worksheets in an excel doc, I've created a button that I can click that invokes my macro that is just moving cells from one work sheet to another. But I need my macro to determine what row I am on. I'm using this:
r = ActiveCell.Row
to determine my row, but what would be the easiest way to use that variable in a range statement like this:
Range("A2").Select
Upvotes: 0
Views: 17228
Reputation: 26640
You could use the Range method with the & operator to join the variable into a string:
Range("A" & r)
Alternately you can use the Cells method which takes arguments (Row, Column):
Cells(r, "A")
Upvotes: 8