Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I copy a range of cells in Excel using variables?
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? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
copy and paste range of cells excluding hidden data in excel | Excel Discussion (Misc queries) | |||
Using variables as first and last cells in range statement | Excel Worksheet Functions | |||
How do I select on two variables in a range of data in excel | Excel Worksheet Functions | |||
Excel Range Variables | Excel Programming | |||
Excel - Copy range of cells based on Combobox Selection | Excel Programming |