Forum Discussion
GEEK_21
Mar 06, 2023Brass Contributor
Exclude VBA from running on a sheet | Help !
Hello everyone. so I have a Workbook with 6 sheets named 1 2 3 4 5
and a sheet named B and I have a VBA code and I want it to run only
on the five sheets and exclude sheet B
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
If Not Application.Intersect(Target, Range("A3:T50")) Is Nothing Then
Range("A3:T50").Interior.ColorIndex = xlColorIndexNone
Target.EntireRow.Interior.ColorIndex = 36
Target.Interior.Color = RGB(255, 160, 122)
End If
End Sub
- Add this as the first line:
If Sh.Name = "B" Then Exit Sub
2 Replies
- JKPieterseSilver ContributorAdd this as the first line:
If Sh.Name = "B" Then Exit Sub- GEEK_21Brass ContributorThank you very much it works