Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8
Default VBA and creating a Macro

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default VBA and creating a Macro

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8
Default VBA and creating a Macro

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8
Default VBA and creating a Macro

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default VBA and creating a Macro

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with creating a Macro Liz J[_2_] Excel Discussion (Misc queries) 6 November 2nd 08 09:34 PM
Creating a Macro? Lynda Excel Discussion (Misc queries) 2 July 21st 08 03:07 PM
VBA macro creating pdf Brad Excel Discussion (Misc queries) 9 June 18th 08 10:25 PM
Creating Macro Chey Excel Discussion (Misc queries) 1 January 18th 07 06:21 PM
Creating a macro Gene Goldenfeld New Users to Excel 10 May 5th 05 04:28 PM


All times are GMT +1. The time now is 08:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"