snasui.com ยินดีต้อนรับ ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ ระบุ Version ของ Excel
Sub Clear_Tab_color()
'
' Clear_Tab_color Macro
'
'
Sheets("Sheet1").Activate
With ActiveWorkbook.Sheets("Sheet1").Tab
.ColorIndex = xlAutomatic
.TintAndShade = 0
End With
With ActiveWorkbook.Sheets("Sheet3").Tab
.ColorIndex = xlAutomatic
.TintAndShade = 0
End With
With ActiveWorkbook.Sheets("Sheet2").Tab
.ColorIndex = xlAutomatic
.TintAndShade = 0
End With
Sheets("Sheet1").Select
Range("B2").Select
End Sub
Sub Clear_Tab_color()
'
' Clear_Tab_color Macro
'
'
Sheets("Sheet1").Activate
With ActiveWorkbook.Sheets("Sheet1").Tab
.ColorIndex = xlAutomatic
.TintAndShade = 0
End With
With ActiveWorkbook.Sheets("Sheet3").Tab
.ColorIndex = xlAutomatic
.TintAndShade = 0
End With
With ActiveWorkbook.Sheets("Sheet2").Tab
.ColorIndex = xlAutomatic
.TintAndShade = 0
End With
Sheets("Sheet1").Select
Range("B2").Select
End Sub
Sub Clear_Tab_color()
Sheets("Sheet1").Tab.ColorIndex = xlColorIndexNone
Sheets("Sheet2").Tab.ColorIndex = xlColorIndexNone
Sheets("Sheet3").Tab.ColorIndex = xlColorIndexNone
End Sub
Sub Clear_Tab_color()
Dim sht As Worksheet
For Each sht In ActiveWorkbook.Worksheets
sht.Select
Range("A1").Select
sht.Tab.ColorIndex = xlColorIndexNone
Next sht
End Sub