VBAN0tNice
New Member
- Joined
- Feb 6, 2020
- Messages
- 1
- Office Version
- 2019
- Platform
- Windows
I have a VBA intake tool that opens up as a main userform
. I have companies that may have different divisions, so I added a second userform that pops up when you check yes for needing to put affiliate, divisional, or, class related information. There's a button I have there that adds different classes, divisions, and affiliates, which are all apparently the same, just a bit different for the labels. I'd like to save what is input in this second userform, because I would like to use it to populate part of my first userform, shown in this thumbnail. Contributions can be based on classes, so each category should show up for the amount of classes I've entered.
VBA Code:
[/adding affiliates button
Dim i As Long
Dim objCtrl As Control
Number = InputBox("Enter # of Affiliate Companies", "Enter # of Affiliates")
Dim txtB1 As Control
Dim intCycle As Integer
For i = 1 To Number * 4
Set txtBl = Controls.Add("Forms.TextBox.1")
With txtBl
.Name = "txtBox" & i
.Height = 18
.Width = 72
.Left = 150
.Top = 160 + 22 * (i - 1) + (intCycle) * 15
.Tag = CStr(intCycle) & " " & CStr(i - intCycle * 4)
End With
If i Mod 4 = 0 Then
intCycle = intCycle + 1
End If
Next i
txtB1.Value
Dim lblL1 As Control
intCycle = 0
For i = 1 To Number * 4
Set lblL1 = Controls.Add("Forms.Label.1")
With lblL1
If i = 1 + 4 * intCycle Then
.Caption = CStr(intCycle + 1) & ". " & "Operating Name/Legal name"
ElseIf i = 2 + 4 * intCycle Then
.Caption = CStr(intCycle + 1) & ". " & "Business Address"
ElseIf i = 3 + 4 * intCycle Then
.Caption = CStr(intCycle + 1) & ". " & "Business Phone #"
ElseIf i = 4 + 4 * intCycle Then
.Caption = CStr(intCycle + 1) & ". " & "Fiscal Year End"
End If
'.Caption = "Plan Administrator Name" & "Plan Administrator #" & "Plan Administrator Email" & "Plan Administrator Address" & i
.Height = 16
.Width = 120
.Left = 20
.Top = 160 + 22 * (i - 1) + (intCycle) * 15
If i Mod 4 = 0 Then
intCycle = intCycle + 1
End If
End With
Next i
For Each objCtrl In Controls
If TypeName(objCtrl) = "TextBox" Then
Debug.Print objCtrl.Tag
End If
'Debug.Print objCtrl.Caption
Next objCtrl
]