evaluting cell contents for "type" and add row if the cell is bla


A

april

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
 
Ad

Advertisements

Ad

Advertisements

D

Don Guillett

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top