我创建了一个带有动态页面的多页。启动用户表单时,用户表单会检查列中特定单元格上的值是否为空。然后为每个非空单元格创建一个页面。
这是我的代码片段
Private Sub UserForm_Initialize()
Dim i As Integer
Dim custDate As Date
Dim vID As String
'ActiveWorkbook.Worksheets("Sheet1").Activate
i = 0
custDate = DateValue(Now)
Range("A1").Offset(1, 0).Select
Do While Not IsEmpty(ActiveCell.Value)
'MsgBox ActiveCell.Address
If custDate = ActiveCell.Value Then 'first column(A) are dates
MultiPage1.Pages.Add
MultiPage1.Pages(0).Controls.Copy 'page 1 is the reference page
i = i + 1 'row counter
ActiveCell.Offset(0, 2).Select 'go to column(C) on the same row where visit ids are located
vID = ActiveCell.Value
MultiPage1.Pages(i).Paste 'copy page 1 contents to new page for each row on the active worksheet
'I guess this is where you put the code to put values
'on a txtbox that was from the reference page which is page 1
ActiveCell.Offset(0, -2).Select 'go back to column(A) to check back dates
End If
ActiveCell.Offset(1, 0).Select 'move to the next row
Loop
MultiPage1.Value = i 'select the new page on the userform
End Sub
现在我的问题是如何将单元格中的值放入从参考隐藏页面复制到动态创建的新页面的文本框中。我昨晚才开始编程 VBA。我是一名 android 应用程序开发人员,所以目前很难调整。