copy from above row

vijay2482

Board Regular
Joined
Mar 3, 2009
Messages
142
i have a excel spreadsheet named "ECN Number".
in this sheet i have a row in which column5 marked with value "x",column22 is empty " " and column23 has "some value".
if the above statement is true,i want to insert an entire blank row and i want to insert another row below this row below the empty row with column6 marked as "x",column22 empty " " and column23 with the samevalue from the above row.
after inserting this row with these values, i want to insert another entire blank row.
i have attached the workbook with the specified sheet, please help to to obtain this result
thanks in advance

[HTML removed]
 
Last edited by a moderator:

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
try using the macro recorder to do each step as you outlined. Use relative refences so that you can use it again at the position you want.
 
Upvote 0
Try following macro code<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
Rich (BB code):
Rich (BB code):
Rich (BB code):
Private Sub mySub()<o:p></o:p>
Dim row As Integer, col As Integer<o:p></o:p>
row = 1<o:p></o:p>
col = 5<o:p></o:p>
<o:p></o:p>
While Sheet1.Cells(row, col).Value <> ""<o:p></o:p>
If Sheet1.Cells(row, 5).Value = "x" And Sheet1.Cells(row, 22).Value = "" And Sheet1.Cells(row, 23).Value = "some value" Then<o:p></o:p>
Sheet1.Rows.Insert<o:p></o:p>
row = row + 1<o:p></o:p>
Sheet1.Rows.Insert<o:p></o:p>
row = row + 1<o:p></o:p>
Sheet1.Cells(row, 5).Value = Sheet1.Cells(row - 2, 5).Value<o:p></o:p>
Sheet1.Cells(row, 22).Value = Sheet1.Cells(row - 2, 22).Value<o:p></o:p>
Sheet1.Cells(row, 23).Value = Sheet1.Cells(row - 2, 23).Value<o:p></o:p>
End If<o:p></o:p>
row = row + 1<o:p></o:p>
Wend<o:p></o:p>
End Sub<o:p></o:p>
<o:p></o:p>
 
Upvote 0

Forum statistics

Threads
1,214,642
Messages
6,120,698
Members
448,979
Latest member
DET4492

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top