spflash
06-09-2006, 05:27 AM
Hi All,
Using the code below I'm attempting to populate all empty cells in a given range with zeroes. I'm able to get the loop that takes care of the rows (i.e.- i's) to work by itself. However, when I nest this loop inside the one for columns (i.e. - j's) I get errors. Can anyone help me create code that populates the rows and columns that are empty with zeroes?
Thanks
spflashSub Zeroes
Dim FinalRow As Long
Dim FinalCol As Long
FinalRow = Cells(65536, 1).End(xlUp).Row
FinalCol = Cells(1, 255).End(xlToLeft).Column
For i = 2 To FinalRow
For j = 8 To FinalCol
If Cells(i, j).Value = "" Then
Cells(i, j) = "0"
End If
Next j
Next i
End Sub
Using the code below I'm attempting to populate all empty cells in a given range with zeroes. I'm able to get the loop that takes care of the rows (i.e.- i's) to work by itself. However, when I nest this loop inside the one for columns (i.e. - j's) I get errors. Can anyone help me create code that populates the rows and columns that are empty with zeroes?
Thanks
spflashSub Zeroes
Dim FinalRow As Long
Dim FinalCol As Long
FinalRow = Cells(65536, 1).End(xlUp).Row
FinalCol = Cells(1, 255).End(xlToLeft).Column
For i = 2 To FinalRow
For j = 8 To FinalCol
If Cells(i, j).Value = "" Then
Cells(i, j) = "0"
End If
Next j
Next i
End Sub