How do I copy a range of cells in Excel using variables?
Take a look at this code...
Sub test()
Dim rngMyRange As Range
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim l As Integer
i = 1
j = 1
k = 10
l = 10
Set rngMyRange = ActiveSheet.Range(Cells(i, j), Cells(k, l))
rngMyRange.Copy
End Sub
Without more info on what you want in terms of variables, it is hard to give
more info... But this should give you a start.
HTH
"Dominic Prince" wrote:
I need to copy a range of cells from one worksheet to another worksheet in
the same workbook, but i need to define where the range is using variables
and i can't seem to get the range selection to work...
is there a way to code using the range function and variables or is there
another way to do it?
|