![]() |
Insert New row if Column G = "P"
I can't seem to get this, but
if I wanted to run a macro that would start at cell G50 and move upward to Cell G18 testing for the value P and if it is found insert a single row beneath it (passing on all other rows that do not have P), how would I do this? TIA, |
Insert New row if Column G = "P"
Try:
Sub InsertRow() For irow = 50 To 8 Step -1 If Cells(irow, "G") = "P" Then Cells(irow + 1, "G").Insert Shift:=xlDown End If Next irow End Sub "Jim May" wrote: I can't seem to get this, but if I wanted to run a macro that would start at cell G50 and move upward to Cell G18 testing for the value P and if it is found insert a single row beneath it (passing on all other rows that do not have P), how would I do this? TIA, |
All times are GMT +1. The time now is 10:09 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com