ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   formula to blank cells (https://www.excelbanter.com/excel-programming/416704-formula-blank-cells.html)

joemeshuggah

formula to blank cells
 
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

Rick Rothstein

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



joemeshuggah

formula to blank cells
 
Thank you!!!!

"Rick Rothstein" wrote:

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





All times are GMT +1. The time now is 04:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com