Forum Discussion
Selecting an Excel Range in VBA
This code will not work as this is not a best practice to use .select
May I know what you want to achieve.
IF you want to copy the range from another sheet. you can do it with this code.
Sheets("Groups").Range("A2:A5").copy Sheets("Weekly").Range("A1")
A1 is a destination where you want to paste
Now if you want to use your integers. you can do it like this:
Sheets("Groups").Range("A" & DateR & ":" & "A" & Date R).copy Sheets("Weekly").Range("A1")
Application.cutcopymode =false
Considering DateR is a row
Else you can use very simple trick:
Sheets("Weekly").Range("A1").value = Sheets("Group").Range("A2").value
Or else
Sheets("Weekly").Range("A" & DateR).value = Sheets("Group").Range("A" & DateR).value
you can modify your code accoridngly. Right part is destination and Left part from where you want to copy the value
You should write VBA code what you want to achieve without selecting the range