Discussion Locked

Excel macro to insert row then copy formulas to

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
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.

3 replies

by amanabala

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)

by sfath

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.

This discussion is closed to new replies.