English 中文(简体)
VBA 确保至少检查一个检查箱的守则
原标题:VBA Code to ensure that at least one checkbox is checked

我有一份表格(标题替换的当事方),从原来的表格(表格)开放,它使用核对箱跟踪重建中替换的部分。 共有26个检查箱。 在你选择替换的部件后,你将“接受改动”印地文。 如果不检查任何箱子,那就希望有一个烟箱,而且不希望用户能够继续使用,直到至少检查一个箱子。 如果至少要检查一次,那么,一想替代的当事方隐藏(显示原形式)和是,就没有替换的部件而言,确实包括最后的箱子。 仅需要一条能做到这一点的略微的法典。

我尝试了几个不同的想法,即在线发现,但迄今没有任何工作。

问题回答

该法典显示,在允许Button指挥之前,验证局是有效的。 但是,如果至少检查了一台测验Box,则只有停机。

  Disable button when userform loading
Private Sub UserForm_Initialize()
    Me.btnOK.Enabled = False
End Sub
  Exit button
Private Sub btnExit_Click()
    Unload Me
End Sub
  CheckBox click event
Private Sub CheckBox1_Click()
    Call UpdateBtn
End Sub
Private Sub CheckBox2_Click()
    Call UpdateBtn
End Sub
Private Sub CheckBox3_Click()
    Call UpdateBtn
End Sub
Private Sub CheckBox4_Click()
    Call UpdateBtn
End Sub
Sub UpdateBtn()
    Dim bCheck As Boolean
    bCheck = False
    For Each c In Me.Controls
        If TypeName(c) = "CheckBox" Then
            If c Then
                bCheck = True
                Exit For
            End If
        End If
    Next
    Me.btnOK.Enabled = bCheck
End Sub

“enterography





相关问题
import of excel in SQL imports NULL lines

I have a stored procedure that imports differently formatted workbooks into a database table, does work on them then drops the table. Here is the populating query. SELECT IDENTITY(INT,1,1) AS ID ...

Connecting to Oracle 10g with ODBC from Excel VBA

The following code works. the connection opens fine but recordset.recordCount always returns -1 when there is data in the table. ANd If I try to call any methods/properties on recordset it crashes ...

Excel date to Unix timestamp

Does anyone know how to convert an Excel date to a correct Unix timestamp?

C# GemBox Excel Import Error

I am trying to import an excel file into a data table using GemBox and I keep getting this error: Invalid data value when extracting to DataTable at SourceRowIndex: 1, and SourceColumnIndex: 1. As ...

Importing from excel "applications" using SSIS

I am looking for any tips or resources on importing from excel into a SQL database, but specifically when the information is NOT in column and row format. I am currently doing some pre-development ...

热门标签