Insert Copy Paste on Criteria

danjw_98

Active Member
Joined
Oct 25, 2003
Messages
354
I was hoping that I might ask for some assistance with this macro.

I am trying to copy a row based on the criteria in column g if it does not match what is in column j and copy/insert entire row in the row below it. Also would like to copy/insert x number of times based on the value in column l.

would appreciate any help with this and thanks..
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
This is what i have so far but not working. Please help if you can. thanks...

Sub TEST()

finalrow = Range("A65536").End(xlUp).Row
For x = 2 To finalrow
val1 = Range("g" & x).Value
val2 = Range("j" & x).Value
val3 = Range("l" & x).Value
If val1 <> val2 Then
Range("a" & x).Offset(1, 0).EntireRow.Resize(val3).Insert

End If

Next x

End Sub
 
Upvote 0
I got the below to insert but can't figure out how to copy to the inserted rows. please help thanks...

Sub InsertOnMultiCriteria()

finalrow = Range("A65536").End(xlUp).Row
For x = 2 To finalrow

val1 = Range("g" & x).Value
val2 = Range("j" & x).Value
val3 = Range("l" & x).Value
If val1 <> val2 Then

Range("a" & x).Offset(1, 0).EntireRow.Resize(val3).Insert


End If
Next x
 
Upvote 0

Forum statistics

Threads
1,224,525
Messages
6,179,319
Members
452,905
Latest member
deadwings

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