Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I seem to be missing how to reference celles properly, any help appreciated:
Dim i As Integer For i = maxrows To 2 Step -1 Range("cells(i,1):cells(i,2)").Select Selection.Cut Destination:=Range("cells(i-1,3):cells(i-1,4)") Next i |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On 16 nov, 01:11, Bob Zimski
wrote: I seem to be missing how to reference celles properly, any help appreciated: * Dim i As Integer * For i = maxrows To 2 Step -1 * * Range("cells(i,1):cells(i,2)").Select * * Selection.Cut Destination:=Range("cells(i-1,3):cells(i-1,4)") * Next i Hello, It seems to be Range(cells(i,1),cells(i,2)").Select instead of Range ("cells(i,1):cells(i,2)").Select Hope this helps Regards |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You could use:
Range(cells(i,1),cells(i,2)).Select or cells(i,1).resize(1,2).select (resize that cell in column A to 1 row by 2 columns. so Dim i As Long Dim maxrows As Long maxrows = 5 'for testing For i = maxrows To 2 Step -1 Cells(i, 1).Resize(1, 2).Cut _ Destination:=Cells(i - 1, 3) Next i Excel will resize the destination range. Just like if you did it manually, you could just select the topleft cell of the destination range. Bob Zimski wrote: I seem to be missing how to reference celles properly, any help appreciated: Dim i As Integer For i = maxrows To 2 Step -1 Range("cells(i,1):cells(i,2)").Select Selection.Cut Destination:=Range("cells(i-1,3):cells(i-1,4)") Next i -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Referencing a named range based upon Range name entry in cell | Excel Worksheet Functions | |||
Incorrectly getting "Subscript out of range" Error. | Excel Programming | |||
range referencing | Excel Programming | |||
range referencing | Excel Programming |