EXCEL TOOLS
Excel Add-ins ที่พัฒนาโดยคุณสันติพงศ์ ณสุย (MVP Excel 2010-2020) ด้วยภาษา C# เพื่อแก้ไขปัญหาไฟล์ใหญ่ คำนวณนาน ทำงานช้า จัดการข้อมูลต่าง ๆ ที่ทำงานประจำวันได้อย่างสะดวกรวดเร็ว สนใจคลิกไปดูได้ที่นี่ครับ => Excel Tools
Excel Add-ins ที่พัฒนาโดยคุณสันติพงศ์ ณสุย (MVP Excel 2010-2020) ด้วยภาษา C# เพื่อแก้ไขปัญหาไฟล์ใหญ่ คำนวณนาน ทำงานช้า จัดการข้อมูลต่าง ๆ ที่ทำงานประจำวันได้อย่างสะดวกรวดเร็ว สนใจคลิกไปดูได้ที่นี่ครับ => Excel Tools
[code]
และปิดด้วย [/code]
ตัวอย่างเช่น [code]dim r as range[/code]
เพื่อให้แตกต่างจากข้อความทั่วไป สะดวกในการอ่านและทดสอบ (คลิกเพื่อดูตัวอย่าง)Code: Select all
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
Code: Select all
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
Code: Select all
Sub checkAll()
Check.check1 = Not Check.check2
End Sub
Code: Select all
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
ใช้งานได้ดีทีเดียวครับsnasui wrote:ตัวอย่าง Code ครับ
Code: Select all
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