CSDN博客

img xubo8219

vba checkbox全选

发表于2008/10/2 12:33:00  1270人阅读

 Private Sub CommandButton1_Click()
 
Dim A1 As Object
 
For Each A1 In UserForm1.Controls
   
If TypeName(A1) = "CheckBox" Then
        A1.Value
= 1 '全部取消就 赋值 0
    End If
 
Next
End Sub

 

 

http://topic.csdn.net/u/20081002/09/7cd84abd-b555-4aaf-acb9-5c458a482745.html?seed=1011906989

 

 

If UserForm1.CommandButton1.Caption = "全选" Then
              UserForm1.CommandButton1.Caption = "全没选"
Else
            UserForm1.CommandButton1.Caption = "全选"
End If
For Each cn In UserForm1.Controls
    If cn.Name Like "*CheckBox*" Then
        If UserForm1.CommandButton1.Caption = "全选" Then
           cn.Value = False
        Else
            cn.Value = True
         End If
    End If
Next

 

http://club.excelhome.net/dispbbs.asp?boardid=2&id=358364&star=1#44130

0 0

相关博文

我的热门文章

img
取 消
img