Copy, Paste and Rename a Range using a macro

  • Thread starter Thread starter max.hug
  • Start date Start date
M

max.hug

I have been attempting to copy, paste and rename a range using an
Excel macro. I have a specific line that I want the new range copied
to in each instance (a line with a named range for a cell) and so far
I have this:

Sub Add_Task()
'
' Add_Task Macro
'

'
Range("Task1").Select
Selection.Copy
Range("LaborTotals").Offset(-1, 0).Select
Selection.Insert Shift:=xlDown
End Sub

I cannot get the range to rename and I cannot get a blank row between
the first range and the second. Can someone assist? Thanks.
 
Hi,

What you need to do is make the name of the range dynamic. Go to Insert -->
Name and then define. Name your range "Labour Totals"

And then in the refers to:

=OFFSET($A$1,0,0,COUNTA($A:$A),1)

or what ever the left column of the range is.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top