Learning Excel
Board Regular
- Joined
- Jul 27, 2002
- Messages
- 99
Hi,
I have a workbook with a number of sheets.
I am trying to fill up some cells that are blank and have this crude code.
However, the macro will only work if I go to each sheet and run the macro
which this is not what I want.
I have save this macro in a module and would hope that it can run fill
up all the sheets that have blank cells as in the ranges when the macro is run
Hope some guidance on this.
Sub FillBlank()
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In Worksheets
If Range("B36") = "" Then Range("B36") = 0
If Range("C36") = "" Then Range("C36") = 0
If Range("D36") = "" Then Range("D36") = 0
If Range("B43") = "" Then Range("B43") = 0
If Range("C43") = "" Then Range("C43") = 0
If Range("D43") = "" Then Range("D43") = 0
If Range("B50") = "" Then Range("B50") = 0
If Range("C50") = "" Then Range("C50") = 0
If Range("D50") = "" Then Range("D50") = 0
If Range("B57") = "" Then Range("B57") = 0
If Range("C57") = "" Then Range("C57") = 0
If Range("D57") = "" Then Range("D57") = 0
Next ws
End Sub
Thank
Note : I only want to fill the above ranges which is blank and not any other rows although they may be blank
NB: I have to fill the cells because I have many workbooks which I need to
extra data and this blank cells are giving me problem row offset to paste
the data and would fill up incorrectly due to the blank cell
I have a workbook with a number of sheets.
I am trying to fill up some cells that are blank and have this crude code.
However, the macro will only work if I go to each sheet and run the macro
which this is not what I want.
I have save this macro in a module and would hope that it can run fill
up all the sheets that have blank cells as in the ranges when the macro is run
Hope some guidance on this.
Sub FillBlank()
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In Worksheets
If Range("B36") = "" Then Range("B36") = 0
If Range("C36") = "" Then Range("C36") = 0
If Range("D36") = "" Then Range("D36") = 0
If Range("B43") = "" Then Range("B43") = 0
If Range("C43") = "" Then Range("C43") = 0
If Range("D43") = "" Then Range("D43") = 0
If Range("B50") = "" Then Range("B50") = 0
If Range("C50") = "" Then Range("C50") = 0
If Range("D50") = "" Then Range("D50") = 0
If Range("B57") = "" Then Range("B57") = 0
If Range("C57") = "" Then Range("C57") = 0
If Range("D57") = "" Then Range("D57") = 0
Next ws
End Sub
Thank
Note : I only want to fill the above ranges which is blank and not any other rows although they may be blank
NB: I have to fill the cells because I have many workbooks which I need to
extra data and this blank cells are giving me problem row offset to paste
the data and would fill up incorrectly due to the blank cell