nitrammada
Board Regular
- Joined
- Oct 10, 2018
- Messages
- 78
- Office Version
- 365
- Platform
- Windows
Hi Everyone,
I'm trying to do a find and replace on over 300 very hidden sheets on data I have in column L.
I big shout of thanks to Rick Rothstein who's code works perfectly on a visible sheet.
Others have assisted me with other routines on very hidden sheets (thanks to Crystalyser) and it works perfectly so I figured I could just swap Rick Rothstein's code and it would run.
But of course I figured wrong. My code is below if anyone could help, as always, I'm always grateful.
I'm trying to do a find and replace on over 300 very hidden sheets on data I have in column L.
I big shout of thanks to Rick Rothstein who's code works perfectly on a visible sheet.
Others have assisted me with other routines on very hidden sheets (thanks to Crystalyser) and it works perfectly so I figured I could just swap Rick Rothstein's code and it would run.
But of course I figured wrong. My code is below if anyone could help, as always, I'm always grateful.
VBA Code:
Sub Replacements3()
Dim lWS_Visible_State As Long
Dim ws As Worksheet, MyRng As Range
Dim X As Long, FindThese As Variant, ReplaceWith As Variant
Application.ScreenUpdating = False
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
'This works on a single visible sheet only
For Each ws In Worksheets
ws.Unprotect
If ws.Range("A1") = "L2" And ws.Range("M6") = "H5" Then
lWS_Visible_State = ws.Visible
ws.Visible = xlSheetVisible
FindThese = Array("36001", "37001")
ReplaceWith = Array("36000", "37000")
For X = LBound(FindThese) To UBound(FindThese)
Columns("L:L").Replace FindThese(X), ReplaceWith(X), xlWhole, , True, , False, False
Next
ws.Visible = lWS_Visible_State
End If
ws.Protect
Next ws
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub