Insert New Row based on qualifier

mattyro1

Board Regular
Joined
Feb 10, 2009
Messages
96
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hello All,

I have searched a few sites but with no luck. I am in need a VBA code that will create new row based on a condition. The condition is whether Column "O" contains any information. If so, create a row below the original and copy "A:AT" and paste into that new row.

I will need to continue to run this unless there is a way to make the same condition above but for Columns P, Q, R...thru AD. I can change the code manually if it becomes too complicated.

Any help would greatly be appreciated!
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Hello All,

I have searched a few sites but with no luck. I am in need a VBA code that will create new row based on a condition. The condition is whether Column "O" contains any information. If so, create a row below the original and copy "A:AT" and paste into that new row.

I will need to continue to run this unless there is a way to make the same condition above but for Columns P, Q, R...thru AD. I can change the code manually if it becomes too complicated.

Any help would greatly be appreciated!

I've been able to get start off with the below...but still missing some steps such as copy the above data and paste it in the new row...Any idea's of perhaps a more efficient way of writing out this code???

Sub test()
Dim i As Long
For i = Range("O11149").End(xlUp).Row To 1 Step -1
If Range("O" & i).Value <> "N/A" Then
Range("A" & i).Offset(1, 0).EntireRow.Insert
End If
Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,502
Messages
6,179,126
Members
452,890
Latest member
Nikhil Ramesh

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