Through browsing this group, I have been able to apply code to all the
sheets in my workbook with the following test code.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address <> "$E$2" Then Exit Sub
Dim sh As Worksheet
For Each sh In ActiveWorkbook.Worksheets
sh.Activate
sh.Range("G2") = "test worked"
Next
End Sub
'--------------------------------------------------------------------------------------------
Is there any way to call a sub to all worksheets. I've tried
replaceing the SH.RANGE line with CALL TEST and it did not apply it to
all sheets. I've tried using WITH statements as follows:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address <> "$E$2" Then Exit Sub
Dim sh As Worksheet
For Each sh In ActiveWorkbook.Worksheets
sh.Activate
with sh
call test
end with
Next
End Sub
This did not work either. Any suggestions?
Bookmarks