VBA Select range with two variables

I am trying to select range. I have no problem selecting it with variable, lets say x and y are variables. I have no problem writing code to select range from e.g. A1:By. But How do I select a range from Ax:By ? Is there simple one line solution to this?

Thanks in advance for help

My code for A1:By which works

Sheets("Sim").Range("A1:B" & y).Select

My made code from Ax:By which does not work

Sheets("Sim").Range("A" & x ":B" & y).Select

Upvotes: 1

Views: 12437

Answers (1)

braX
braX

Reputation: 11755

You left out an ampersand....

Sheets("Sim").Range("A" & x & ":B" & y).Select

Upvotes: 3

Related Questions