Replace each blank to a 0 in multiple sheets..

omairhe

Well-known Member
Joined
Mar 26, 2009
Messages
2,040
Office Version
  1. 2019
Platform
  1. Windows
Peace all,

In worksheets that has name something like "*simple*" , not exact match neither case sensitive.

In Column "F", replace each blank to a = 0 for until last data cell in column A.

Anyone?
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Untested...

Code:
Sub Replace_0()
Dim ws As Worksheet
Dim Last_Row As Long
Application.ScreenUpdating = False
For Each ws In ThisWorkbook.Worksheets
    With ws
        If .Name Like "*simple*" Then
            Last_Row = .Range("A" & Rows.Count).End(xlUp).Row
            Range(.Cells(1, 6), .Cells(Last_Row, 6)).SpecialCells(xlCellTypeBlanks) = 0
        End If
    End With
Next ws
Application.ScreenUpdating = True
End Sub
 
Last edited:
Upvote 0
Code:
Sub Test()
Application.ScreenUpdating = False
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
    If ws.Name Like "*simple*" Then
        Range("A1").Select
        Do Until ActiveCell.Value = ""
        If ActiveCell.Offset(0, 5).Value = "" Then ActiveCell.Offset(0, 5).Value = 0
        ActiveCell.Offset(1, 0).Select
        Loop
    End If
Next ws
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,203,099
Messages
6,053,522
Members
444,669
Latest member
Renarian

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top