evaluting cell contents for "type" and add row if the cell is bla
i want to add rows if the contents of a cell in the row is blank. i am using
this macro. i want the macro to go down column c to look for blank cells - if it encounters a blank cell, i want to insert a row. getting an error message with the "if statement" thanks in advance for the help -- range("c9").Select Count = 0 Do Until Count = 200 ActiveCell.Offset(1, 0).Select If ActiveCell.FormulaR1C1 = "=CELL(""type"" = "b")" Then ActiveCell.EntireRow.Select Selection.Insert Shift:=xlDown ActiveCell.Offset(1, 0).Select Else ActiveCell.Offset(1, 0).Select End If Count = Count + 1 Loop End Sub aprilshowers |
evaluting cell contents for "type" and add row if the cell is bla
Hi April,
What about : If IsEmpty(ActiveCell.Value) Then HTH Carim |
evaluting cell contents for "type" and add row if the cell is bla
Assumes length of occupied cells greater than 1 character.
Sub insertrowifblank() For i = Cells(Rows.Count, "c").End(xlUp).Row To 2 Step -1 If Len(Cells(i, "c")) < 2 And Len(Cells(i - 1, "c")) 1 Then Rows(i).Insert Next End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "april" wrote in message ... i want to add rows if the contents of a cell in the row is blank. i am using this macro. i want the macro to go down column c to look for blank cells - if it encounters a blank cell, i want to insert a row. getting an error message with the "if statement" thanks in advance for the help -- range("c9").Select Count = 0 Do Until Count = 200 ActiveCell.Offset(1, 0).Select If ActiveCell.FormulaR1C1 = "=CELL(""type"" = "b")" Then ActiveCell.EntireRow.Select Selection.Insert Shift:=xlDown ActiveCell.Offset(1, 0).Select Else ActiveCell.Offset(1, 0).Select End If Count = Count + 1 Loop End Sub aprilshowers |
All times are GMT +1. The time now is 06:25 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com