Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
looking for a Macro for a Command Button
When i click on the Command Button, I want it to automatically -Insert a New Row (last row) -Copy an already formatted Row -and Paste it onto the newly Inserted Row -- thanx |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Why insert a new row beyond the last used row?
Why not just copy the row you want and paste it to the next blank row below last used row? Sub findbottom_paste22() Dim rng1 As Range Dim rng2 As Range Set rng1 = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0) Set rng2 = ActiveCell.EntireRow 'adjust activecell to a range? rng2.Copy Destination:=rng1 End Sub Gord Dibben MS Excel MVP On Tue, 27 Jan 2009 16:40:01 -0800, tommy .(donotspam) wrote: looking for a Macro for a Command Button When i click on the Command Button, I want it to automatically -Insert a New Row (last row) -Copy an already formatted Row -and Paste it onto the newly Inserted Row |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I can't just copy and paste since I have locked that area of the worksheet.
It has to be locked in order to keep other users from f.... up my worksheet the command button is meant to make it easy for them - just click and magic happens -- thanx "Gord Dibben" wrote: Why insert a new row beyond the last used row? Why not just copy the row you want and paste it to the next blank row below last used row? Sub findbottom_paste22() Dim rng1 As Range Dim rng2 As Range Set rng1 = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0) Set rng2 = ActiveCell.EntireRow 'adjust activecell to a range? rng2.Copy Destination:=rng1 End Sub Gord Dibben MS Excel MVP On Tue, 27 Jan 2009 16:40:01 -0800, tommy .(donotspam) wrote: looking for a Macro for a Command Button When i click on the Command Button, I want it to automatically -Insert a New Row (last row) -Copy an already formatted Row -and Paste it onto the newly Inserted Row |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
maybe this will help you understand better
rows 1 through 39 are ulocked rows 40 through end are locked when i click the command button, i want a new row inserted (in row 40) copy row 39 and paste onto the new row 40 another thing, what is this findbutton ? -- thanx "Gord Dibben" wrote: Why insert a new row beyond the last used row? Why not just copy the row you want and paste it to the next blank row below last used row? Sub findbottom_paste22() Dim rng1 As Range Dim rng2 As Range Set rng1 = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0) Set rng2 = ActiveCell.EntireRow 'adjust activecell to a range? rng2.Copy Destination:=rng1 End Sub Gord Dibben MS Excel MVP On Tue, 27 Jan 2009 16:40:01 -0800, tommy .(donotspam) wrote: looking for a Macro for a Command Button When i click on the Command Button, I want it to automatically -Insert a New Row (last row) -Copy an already formatted Row -and Paste it onto the newly Inserted Row |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Sub findbottom_paste22()
Dim rng1 As Range Dim rng2 As Range With ActiveSheet .Protect Password:="password", userinterfaceonly:=True Set rng1 = .Cells(Rows.Count, 1).End(xlUp).Offset(1, 0) 'row below last Set rng2 = .Cells(Rows.Count, 1).End(xlUp).EntireRow 'entire last row End With rng2.Copy Destination:=rng1 'copy last row to next row End Sub "password" is whatever you have set for a password There is no "findbutton" Maybe you mean "findbottom" which is part of the macro name. Gord On Tue, 27 Jan 2009 18:16:01 -0800, tommy .(donotspam) wrote: maybe this will help you understand better rows 1 through 39 are ulocked rows 40 through end are locked when i click the command button, i want a new row inserted (in row 40) copy row 39 and paste onto the new row 40 another thing, what is this findbutton ? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Help with creating a Macro | Excel Discussion (Misc queries) | |||
Creating a Macro? | Excel Discussion (Misc queries) | |||
VBA macro creating pdf | Excel Discussion (Misc queries) | |||
Creating Macro | Excel Discussion (Misc queries) | |||
Creating a macro | New Users to Excel |