VBA code to insert rows meeting a condition

BungleNZ

Board Regular
Joined
Sep 9, 2008
Messages
220
Hi, I'm trying to insert a bit of code into my existing click button macro to insert a row based on a condition being met and then insert a formula into the resulting blank cell.

Range to look at = L1:L1000

Condition = "=IF(LEFT(R[-1]C,13)=""ORCSW FRM ***"",""insert row below here"",""go to next"")"

Code to insert into blank cell created in column L = "=""ORCSW HDW PNL ""&TEXT(R[-1]C[-3]*0.2,""00000.00"")&RIGHT(R[-1]C,4)"


Assuming this is easy enough to solve, I then want one final line of code to save the text in order in range L1:L1000 to a file called "labour00.txt", but only cells that have a do not equal "" or are not blank.

Thank you in advance for any help you can give.
 

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.

Forum statistics

Threads
1,215,301
Messages
6,124,146
Members
449,145
Latest member
el_gazar

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