excel userform - 设置/重置变量以识别/使用框架

时间:2016-01-14 22:54:50

标签: excel excel-vba userform vba

我在userform上有许多帧,我有一组复选框,其中包含框架内框架的名称(" SectorsFrame")。我想从" SectorsFrame"开始,使用复选框的标签来识别要使用的下一帧,然后在下一帧内重复该步骤。

我无法重新设置/重命名我的frame-name变量。对此有何帮助?

Private Sub cmdCopy_Click()
Dim chkBox As Control
Dim cmbBox As Control
Dim frmSource As MSForms.Frame
'Dim frmSource As String
Dim valSectCopy1 As String 'to validate that a sector is filled in
Dim valSectCopy2 As String 'to validate that an antenna is filled in
Dim valPortCopy As String 'to validate that a port is filled in

Set frmSource = SectorsFrame
valSectCopy1 = ""
valSectCopy2 = ""
valPortCopy = ""


    For Each chkBox In frmSource.Controls 'Sector-level frame
        If TypeName(chkBox) = "CheckBox" And chkBox.Value = True Then
            valSectCopy1 = chkBox.Tag
            valSectCopy2 = valSectCopy1
            Set frmSource = valSectCopy1
            Exit For
        End If
    Next chkBox

这是当前发脾气的界限:

Set frmSource = valSectCopy1

0 个答案:

没有答案