Macro to Update all worksheets
Hi,
Try this, You must qualify the range by using WS.cells. Note that MyFactor
is a variable and your replacing a text value. If the variable is given a
value you will simply end up with empty cells. Did you really mean
WS.Cells.Replace What:="FactorName", Replacement:="MyFactor"
Dim WS As Worksheet
For Each WS In ActiveWorkbook.Worksheets
WS.Cells.Replace What:="FactorName", Replacement:=MyFactor
Next WS
Mike
"Bongard" wrote in message
...
Hi, I am having an issue with this macro actually updating all the
sheets in a workbook. I am trying to do a find/replace for each tab in
a workbook - should be simple right?
Here's my code
Dim WS As Worksheet
For Each WS In ActiveWorkbook.Worksheets
Range("A1").Select
Cells.Replace What:="FactorName", Replacement:=MyFactor
Next WS
It find's and replaces the first sheet just fine, and as I step
through the code it repeats as many times as their are worksheets (10
times, once for each worksheet) but for only the first sheet is
updated. Not sure what's going on.
I'm sure this is simple, thanks for your help.
Brian
|