Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Each month I add 2 rows from the bottom of the previous month.
To do this I would like some assistance please. I thought it would encompass Range [A36636].Select Selection.End(xlUp).Offset(-1, 0).Row 'then somehow select the bottom two used rows and copy them directly underneath the copied rows Thanks for your help. Unfortunately I have ye tto learn much about the Row property. Regards, Si |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I would prefer to see an example of before and after desires but maybe this
helps preferred myrow=cells(rows.count,"a").end(xlup).row-1 or myrow=range("a65536").end(xlup).row-1 -- Don Guillett Microsoft MVP Excel SalesAid Software "Simon" wrote in message ... Each month I add 2 rows from the bottom of the previous month. To do this I would like some assistance please. I thought it would encompass Range [A36636].Select Selection.End(xlUp).Offset(-1, 0).Row 'then somehow select the bottom two used rows and copy them directly underneath the copied rows Thanks for your help. Unfortunately I have ye tto learn much about the Row property. Regards, Si |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You just want to copy the last 2 rows to the bottom of the range?
Dim RngToCopy as range dim DestCell as range with activesheet set rngtocopy = .cells(.rows.count,"A").end(xlup).offset(-1,0) set destcell = .cells(.rows.count,"A").end(xlup).offset(1,0) end with rngtocopy.resize(2,1).entirerow.copy _ destination:=destcell Simon wrote: Each month I add 2 rows from the bottom of the previous month. To do this I would like some assistance please. I thought it would encompass Range [A36636].Select Selection.End(xlUp).Offset(-1, 0).Row 'then somehow select the bottom two used rows and copy them directly underneath the copied rows Thanks for your help. Unfortunately I have ye tto learn much about the Row property. Regards, Si -- Dave Peterson |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Aug 5, 4:19*pm, Dave Peterson wrote:
You just want to copy the last 2 rows to the bottom of the range? Dim RngToCopy as range dim DestCell as range with activesheet * set rngtocopy = .cells(.rows.count,"A").end(xlup).offset(-1,0) * set destcell = .cells(.rows.count,"A").end(xlup).offset(1,0) end with rngtocopy.resize(2,1).entirerow.copy _ * destination:=destcell Simon wrote: Each month I add 2 rows from the bottom of the previous month. To do this I would like some assistance please. I thought it would encompass Range [A36636].Select Selection.End(xlUp).Offset(-1, 0).Row 'then somehow select the bottom two used rows and copy them directly underneath the copied rows Thanks for your help. *Unfortunately I have ye tto learn much about the Row property. Regards, Si -- Dave Peterson- Hide quoted text - - Show quoted text - Hi Dave, It works, you are a genius! Does the A in cells(.rows.count,"A").end(xlup).offset(-1,0) refer to column A? What does Resize(2, 1) do? thanks. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This should work. It finds the last occupied cell in Column A, copies that
row and the row above it, then pastes it directly under the last occupied row. Range("A65536").End(xlUp).Select ActiveCell.Offset(-1, 0).Select Rows(ActiveCell.Row & ":" & ActiveCell.Offset(1, 0).Row).Copy ActiveCell.Offset(2, 0).Select Rows(ActiveCell.Row & ":" & ActiveCell.Offset(1, 0).Row).Select ActiveSheet.Paste Application.CutCopyMode = False Hope this helps, Jim -- I appreciate any feedback. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|