Hi,
I'm trying to learn VBA, and I'm getting stuck on the code that I have. Sorry that it is really amateur. I'd like to run this code that changes all blank cells to zeros in a specific range only on the worksheets who have a specific keyword in the tab name - I'd like the code to run on all tabs containing the word "Finance" as part of the worksheet name. What I have so far only works on the active sheet. It doesn't go through the entire workbook.
any help would be appreciated...
I'm trying to learn VBA, and I'm getting stuck on the code that I have. Sorry that it is really amateur. I'd like to run this code that changes all blank cells to zeros in a specific range only on the worksheets who have a specific keyword in the tab name - I'd like the code to run on all tabs containing the word "Finance" as part of the worksheet name. What I have so far only works on the active sheet. It doesn't go through the entire workbook.
Code:
Sub AddZero2()
Dim cell As Range
Dim wks As Excel.Worksheet
For Each wks In ThisWorkbook.Worksheets
If InStr(wks.Name, "Finance") <> 0 Then
For Each cell In Range("E87:AJ98")
If Len(cell.Value) = 0 Then
cell.Value = 0
End If
Next cell
End If
Next wks
End Sub
any help would be appreciated...