Create a macro

  • Thread starter Thread starter JOYCE
  • Start date Start date
J

JOYCE

I have a spreadsheet that contains several formulas in
each row. I want to be able to insert a new row in this
spreadsheet that will contain these formulas without
having to copy and paste a row from above or below.

The macro I created works correctly only once. Everything
shifts down from the insertion point which loses the cell
reference, plus it only wants to insert at the exact row
when the macro was recorded.

The only experience I've had in macros was a long time ago
(Lotus123 DOS). Please help...I would love to learn more!



Sub Macro1()
'
' Macro1 Macro
' Inserts a new row with formulas
'
' Keyboard Shortcut: Ctrl+i
'
Rows("103:103").Select
Selection.Insert Shift:=xlDown
End Sub
 
Joyce,

Try this code

ActiveCell.EntireRow.Insert Shift:=xlDown
ActiveCell.Offset(1, 0).EntireRow.Copy
ActiveCell.PasteSpecial Paste:=xlPasteFormulas

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

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

Similar Threads


Back
Top