I'm new to VBA, and I got stuck with a simple problem. I want to select all cells with data in the worksheet, paste them by value, then replace "#NUM!" with ""(nothing) and repeat all the above steps in all worksheets. The issue is that it wouldn't loop through all worksheets. Please help.
Sub Test()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Sheets
'Select all, copy and paste-by-value
ws.Range("A1").CurrentRegion.Value = ws.Range("A1").CurrentRegion.Value
'Find and Replace
Cells.Replace What:="#NUM!", Replacement:=""
Next ws
End Sub