snasui.com ยินดีต้อนรับ ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ ระบุ Version ของ Excel
Sub check1()
Range("E8:X57,AB8:AC57,AJ8:AK57,AG8:AG57").Select
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=LEN(TRIM(E8))=0"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 5287936
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
Range("E8").Select
End Sub
Sub check2()
Range("E8:X57,AB8:AC57,AJ8:AK57,AG8:AG57").Select
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=LEN(TRIM(E8))=0"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.Pattern = xlNone
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
Range("E8").Select
End Sub
Sub checkAll()
With ActiveSheet.Shapes("สี่เหลี่ยมผืนผ้ามุมมน 7").TextFrame2.TextRange.Characters
If .Text = "ตรวจสอบ" Then
Check.check1
.Text = "ยกเลิก"
Else
Check.check2
.Text = "ตรวจสอบ"
End If
End With
End Sub
Sub checkAll()
With ActiveSheet.Shapes("สี่เหลี่ยมผืนผ้ามุมมน 7").TextFrame2.TextRange.Characters
If .Text = "ตรวจสอบ" Then
Check.check1
.Text = "ยกเลิก"
Else
Check.check2
.Text = "ตรวจสอบ"
End If
End With
End Sub