Morning all.
I found the below code to fill a selected range that has empty cells amongst the data to fill the blank cells with whatever input into the resulting pop up box, in this case zero.
It works on part of the worksheet but not on the other, I cannot understand why it will not work on part of the worksheet, the whole of which is formatted the same. You can manually add data to the empty cells?? It works on columns A,B & C or if I inset a new column in the middle of my data it works in that also. The data was pasted into the worksheet A,B & C are not original to this data i.e. inserted after the fact.
I'm bamboozled as to why this is.
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]Sub FillEmptyBlankCellWithValue()
Dim cell As Range
Dim InputValue As Integer
On Error Resume Next
InputValue = InputBox("Enter value that will fill empty cells in selection", _
"Fill Empty Cells")
For Each cell In Selection
If IsEmpty(cell) Then
cell.Value = InputValue
End If
Next
End Sub[/FONT]
I found the below code to fill a selected range that has empty cells amongst the data to fill the blank cells with whatever input into the resulting pop up box, in this case zero.
It works on part of the worksheet but not on the other, I cannot understand why it will not work on part of the worksheet, the whole of which is formatted the same. You can manually add data to the empty cells?? It works on columns A,B & C or if I inset a new column in the middle of my data it works in that also. The data was pasted into the worksheet A,B & C are not original to this data i.e. inserted after the fact.
I'm bamboozled as to why this is.
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]Sub FillEmptyBlankCellWithValue()
Dim cell As Range
Dim InputValue As Integer
On Error Resume Next
InputValue = InputBox("Enter value that will fill empty cells in selection", _
"Fill Empty Cells")
For Each cell In Selection
If IsEmpty(cell) Then
cell.Value = InputValue
End If
Next
End Sub[/FONT]