Page 1 of 1
อยากเขียนมาโครให้เป็นปุ่มเดียวครับ ซ่อนกับแสดง
Posted: Fri Mar 18, 2016 9:48 pm
by yangkodza

จากภาพ ต้องการทำให้ปุ่มซ่อนแสดงอยู่ในปุ่มเดียวกันครับ
Code: Select all
Sub ซ่อน()
'
' ซ่อน แมโคร
'
'
Range("B6:G55").Select
With Selection.Font
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
End With
Range("B6").Select
End Sub
Code: Select all
Sub แสดง()
'
' แสดง แมโคร
'
'
Range("B6:G55").Select
With Selection.Font
.ColorIndex = xlAutomatic
.TintAndShade = 0
End With
Range("B6").Select
End Sub
เวลาเรียน ต้นฉบับ.xlsm
Re: อยากเขียนมาโครให้เป็นปุ่มเดียวครับ ซ่อนกับแสดง
Posted: Fri Mar 18, 2016 10:55 pm
by snasui

ตัวอย่าง Code ครับ
Code: Select all
Range("B6:G55").Select
If Range("b6").Font.ColorIndex = xlAutomatic Then
With Selection.Font
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
End With
Else
With Selection.Font
.ColorIndex = xlAutomatic
.TintAndShade = 0
End With
End If
Range("B6").Select
Re: อยากเขียนมาโครให้เป็นปุ่มเดียวครับ ซ่อนกับแสดง
Posted: Sat Mar 19, 2016 6:09 am
by yangkodza
snasui wrote:
ตัวอย่าง Code ครับ
Code: Select all
Range("B6:G55").Select
If Range("b6").Font.ColorIndex = xlAutomatic Then
With Selection.Font
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
End With
Else
With Selection.Font
.ColorIndex = xlAutomatic
.TintAndShade = 0
End With
End If
Range("B6").Select
ขอบคุณมากครับอาจารย์