BIGTONE559
Active Member
- Joined
- Apr 20, 2011
- Messages
- 336
I currently have code that runs when it's selected however, i would like for the code to run once the sheet is changed.
e.g. when the activesheet is Sheet(1) i would like for it to run once the tab for Sheet(2) is pressed. . . as of now. . the code runs once the sheet is selected. e.g. Sheet(1) is the active sheet when Sheet(2) is clicked it runs on sheet(2).
code:
As always thanks
Cheers!
e.g. when the activesheet is Sheet(1) i would like for it to run once the tab for Sheet(2) is pressed. . . as of now. . the code runs once the sheet is selected. e.g. Sheet(1) is the active sheet when Sheet(2) is clicked it runs on sheet(2).
code:
Code:
Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
Dim aSh As Worksheet
Dim aShRange As Range
Set aSh = ActiveSheet
Set aShRange = aSh.Range("C3")
If Not IsNumeric(Application.Match(Sh.Name, Array("HExport"), 0)) Then
If aShRange.Value = "" Then
aSh.Name = aSh.Index
Else
aSh.Name = aShRange.Value
End If
End If
End Sub
As always thanks
Cheers!