Thread
:
Yet another copy/paste macro question
View Single Post
#
3
Posted to microsoft.public.excel.misc
Don Guillett
external usenet poster
Posts: 10,124
Yet another copy/paste macro question
Try this
Sub insertrow()
myrow = ActiveCell.Row + 1
Rows(myrow).Insert
Rows(1).Copy Rows(myrow)
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"Btate0121" wrote in message
...
My apologies in advance if this is redundant. Didn't find what I was
looking
for via search.
I have a client info spreadsheet that i'm looking to automate a bit more.
I
put in a button and tied it to a macro that copies the line the cursor is
on,
inserts a row below where the cursor is, and erases all client data (save
for the cells with formulas in them) to create a blank row with formulas
for
a new client. This is tedious and doesn't work too well when creating
client
data in a new section of the spreadsheet (where this is no source row to
copy
from). Here's what I have:
ows("1:1").EntireRow.Select
Selection.Copy
ActiveCell.Offset(1, 0).Rows("1:1").EntireRow.Select
Selection.Insert Shift:=xlDown
ActiveCell.Select
Application.CutCopyMode = False
Selection.ClearContents
ActiveCell.Offset(0, 1).Range("A1").Select
Selection.ClearContents
ActiveCell.Offset(0, 1).Range("A1").Select
Selection.ClearContents
ActiveCell.Offset(0, 1).Range("A1").Select
Selection.ClearContents
ActiveCell.Offset(0, 1).Range("A1").Select
Selection.ClearContents
ActiveCell.Offset(0, 1).Range("A1").Select
Selection.ClearContents
ActiveCell.Offset(0, 1).Range("A1").Select
Selection.ClearContents
ActiveCell.Offset(0, 1).Range("A1").Select
Selection.ClearContents
ActiveCell.Offset(0, 1).Range("A1").Select
Selection.ClearContents
ActiveCell.Offset(0, 1).Range("A1").Select
Selection.ClearContents
ActiveCell.Offset(0, 1).Range("A1").Select
Selection.ClearContents
ActiveCell.Offset(0, 1).Range("A1").Select
Selection.ClearContents
ActiveCell.Offset(0, 1).Range("A1").Select
Selection.ClearContents
ActiveCell.Offset(0, 2).Range("A1").Select
Selection.ClearContents
ActiveCell.Offset(0, 1).Range("A1").Select
Selection.ClearContents
ActiveCell.Offset(0, 1).Range("A1").Select
Selection.ClearContents
ActiveCell.Offset(0, 1).Range("A1").Select
Selection.ClearContents
ActiveCell.Offset(0, -15).Range("A1").Select
ActiveWindow.ScrollColumn = 10
ActiveWindow.ScrollColumn = 9
ActiveWindow.ScrollColumn = 8
What I would like.. is to eliminate all those rose of "select, clear
contents" and just have it copy the row from "1:1:" where I have a blank
client template.
so.. it would work like this, the cursor is set to the row where the new
line will be put in (the line will be added to the row BELOW where the
cursor
is set), it copies row 1:1, and pastes it into the newly created blank
row.
Thanks in advance!
Reply With Quote
Don Guillett
View Public Profile
Find all posts by Don Guillett