General discussion

Locked

Excel macro to insert row then copy formulas to

By sfath ·
I am trying to create a macro to go to a certain cell then insert a blank row. Once the row is created then go to a range, copy it then return to the first cell in that row and paste.

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by amanabala In reply to Excel macro to insert row ...

Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim l As Integer
Dim m As Integer

i = InputBox("Enter RowNumber to create a new row")

Rows(i).Select
Selection.Insert Shift:=xlDown
j = 2 'Starting Row
k = 1 'Starting Column
l = 12 'Ending Row
m = 4 'Ending Column
' if you know the range to be static, you can hardcode it here
' Range("A2:D12").Select
Range(Cells(j, k), Cells(l, m)).Select
Selection.Copy
Range(Cells(i + 1, 1), Cells(i + 1, 1)).Select
ActiveSheet.Paste
Hope this helps,
Ravi (ananth_manabala@yahoo.com)

Collapse -

by sfath In reply to

This isn't exactly what I needed but it did help me figure out exactly what I was trying to do. Thanks for your help.

Collapse -

by sfath In reply to Excel macro to insert row ...

This question was closed by the author

Back to Web Development Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums