LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Need Simple Copy and Insert Row, Move Down Macro

your change would have been

Row(i + 1).Value = Row(i).Value

That would work if you know before hand that all the values are constants
and not formulas or you want to change any formulas to constants.
Unfortunately, I don't know that. So I used FillDown
--
Regards,
Tom Ogilvy

wrote in message
...
Tom Ogilvy wrote:
Yes, you should say what you mean. You said rows existing and then

showed a
single column of numbers. Here is an adjustment.

Sub AddRows()
Dim lastrow As Long, i As Long
lastrow = Cells(Rows.Count, 1).End(xlUp).Row
For i = lastrow To 1 Step -1
Rows(i + 1).Insert
Rows(i + 1).FillDown
Next
End Sub


Sorry, Apologize for that,

Yes that last does the trick. I did try tweaking it, wondering if just
changing the

Cells(i + 1, 1).Value = Cells(i, 1).Value
to
Row(i + 1, 1).Value = Row(i, 1).Value

was the answer, but I never would have got it to continue without your
code knowledge. I usually will try to trial and error it till I learn
it but sooner or later I guess I need to get some real VBA training.

Thanks much for all the help, gonna save me hours of work tomorrow

Cheers



 
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
Cannot Move, Copy, Insert, Rename, or Delete a Worksheet in Any Wo JG Excel Discussion (Misc queries) 6 February 4th 09 06:42 PM
Macro to insert and move columns andrea Excel Discussion (Misc queries) 3 October 8th 08 06:55 AM
I am unable to insert, move, copy a worksheet jdubyac Excel Discussion (Misc queries) 2 February 4th 08 09:15 PM
Move/Copy or Copy/Insert worksheet? kjk Excel Discussion (Misc queries) 0 December 15th 06 02:40 PM
Help please on a simple macro to insert rows Michelle Curtin Excel Programming 1 October 3rd 03 05:20 PM


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