Code I have so far is:
SHEET1
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngMonitor As Range
Dim rng As Range
Set rngMonitor = Intersect(Range("A6:A199"), Target)
If Not rngMonitor Is Nothing Then
Application.EnableEvents = False
MsgBox "Please do not change the data in column A", vbExclamation
Application.Undo
Application.EnableEvents = True
Exit Sub
End If
Set rngMonitor = Intersect(Range("B6:B199"), Target)
If Not rngMonitor Is Nothing Then
Call AutoFilter_Example1
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Len(Me.Range("D200").Value) = 0 Then Exit Sub
If Application.ActiveSheet.Name <> VBA.Left(Me.Range("D200").Value, 31) Then
Application.ActiveSheet.Name = VBA.Left(Me.Range("D200").Value, 31)
End If
End Sub
Sub AutoFilter_Example1()
Dim i As Long
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
With ActiveSheet
If .AutoFilterMode Then
.AutoFilterMode = False
End If
With .Range("A5:I" & Cells(Rows.Count, "A").End(xlUp).Row)
For i = 1 To .Columns.Count
.AutoFilter Field:=i, VisibleDropDown:=False
Next i
.AutoFilter Field:=1, Criteria1:="<>Hide"
.AutoFilter Field:=9, Criteria1:=""
End With
End With
Application.Calculation = xlCalculationAutomatic
End Sub
THISWORKBOOK
Private Sub Workbook_SheetCalculate(ByVal Sh As Object)
If Sh.Name = ActiveSheet.Name Then
If Range("E200") = "Yes" Or Range("G200") > 4 Then
If Sh.Tab.Color <> RGB(255, 0, 0) Then ' Red
Sh.Tab.Color = RGB(255, 0, 0)
End If
Else
If Sh.Tab.Color <> RGB(146, 208, 80) Then
Sh.Tab.Color = RGB(146, 208, 80) ' Light Green
End If
End If
End If
End Sub
MODULE1
Sub Sort_Tabs_Alphabetically()
For i = 1 To Application.Sheets.Count
For j = 1 To Application.Sheets.Count - 1
If UCase$(Application.Sheets(j).Name) > UCase$(Application.Sheets(j + 1).Name) Then
Sheets(j).Move after:=Sheets(j + 1)
End If
Next
Next
MsgBox "The tabs have been sorted from A to Z."
End Sub
Bookmarks