1

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

1 Answer 1

3

You left out an ampersand....

Sheets("Sim").Range("A" & x & ":B" & y).Select
Sign up to request clarification or add additional context in comments.

3 Comments

beat me be seconds.
FWIW; @JiříJezdinský one should avoid using .Select and just do the action wanted. ie Sheets("Sim").Range("A" & x & ":B" & y).Copy
Thanks for the solution (I just totally forgot about another &). And also thanks for the select notice.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.