Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Creating a Macro

I am using Excel 2003 and would like to great a command
button the when clicked on it would take an entire row,
including embedded text forms and comboboxes, Etc..copy
it to 2 rows below it. and when clicked again it will
copy it 4 rows below it the 6,8,10 etc....This is my
first time working with macros....Thanks for the help...
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Creating a Macro

"Lynch" wrote in message
...
I am using Excel 2003 and would like to great a command
button the when clicked on it would take an entire row,
including embedded text forms and comboboxes, Etc..copy
it to 2 rows below it. and when clicked again it will
copy it 4 rows below it the 6,8,10 etc....<clip


Based on the limited information you gave, here is one way.

Create a module with any name you like.
at the very top (below the words option explicit if you have that turned on)
type
Dim myRowOffset As Integer

This creates a variable that will not reset each time the routine is run.
If you need something to be sheet specific or stored for use to resume
counting in a future excel session, then I recommend saving this value in
the workbook rather than as a variable
now add the following routine below the dim statement you just typed

Sub CopyRow()
Dim OriginalCell As Range

Application.ScreenUpdating = False
Set OriginalCell = ActiveCell
If myRowOffset = 0 Then myRowOffset = 2
With [A1]' <-change the 1 to whatever row you want to copy each time
.EntireRow.Copy
.Offset(myRowOffset).Select
End With
ActiveSheet.Paste
OriginalCell.Select
myRowOffset = myRowOffset + 2
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub

Create a button and assign the macro CopyRow to it and you should be set.

Paul D


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
Creating macro Jamie Excel Worksheet Functions 9 April 6th 10 08:37 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
Need Help Creating A Macro LJ Owen Excel Worksheet Functions 1 March 2nd 05 01:52 PM
help creating a macro Scott Excel Programming 1 December 3rd 03 09:26 AM


All times are GMT +1. The time now is 09:59 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"