View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default formula to blank cells

Your If..Then test should be this...

If Cells(i, 1).Value = "" Then

--
Rick (MVP - Excel)


"joemeshuggah" wrote in message
...
looking to create a macro that loops through rows and fills all blank
cells
in a column with a formula that shows the value in the cell just above.

for example, i want row 3 to read bottom and rows 6 & 7 to read right.

row col A
1 top
2 bottom
3
4 left
5 right
6
7
8 up


i thought something like the below would work, but get an "object
required"
error message

FinalRowMAINROW = Cells(Cells.Rows.Count, "B").End(xlUp).Row

For i = 2 To FinalRowMAINROW
If Cells(i, 1).Value Is Null Then
Cells(i, 1).FormulaR1C1 = "=R[-1]C"
End If
Next i