我有一个带有组合框的用户表单,该组合框填充了存储在隐藏表中的客户端名称列表。我正在尝试这样做,以便用户可以选择一个名称并单击一个按钮,该按钮会显示该客户的个人资料(姓名地址、电话号码等)。
在我做其他领域之前,我试图让它只为这个名字工作。当我查看个人资料时,名称标签(我命名为name_
)是空白的。 ClientBox
是名称为 on 的组合框的名称userform2
,并且ClientProfile
是具有 name_ 标签的用户窗体的名称。
注释掉的最后两行是我在尝试此方法之前尝试过的。两种方法都不起作用。
Sub ProfilePopulator()
Dim index As Integer, str As String
Application.ScreenUpdating = False
Sheets("Clients").Visible = True
Sheets("Clients").Select
Range("A1").Select
index = UserForm2.ClientBox.ListIndex
str = Cells(index + 1, 1)
ClientProfile.Name_.Caption = str
'ActiveCell.Offset(index, 0).Select
'ClientProfile.Name_.Caption = ActiveCell
End Sub