VBA Intake Tool Question

VBAN0tNice

New Member
Joined
Feb 6, 2020
Messages
1
Office Version
  1. 2019
Platform
  1. Windows
I have a VBA intake tool that opens up as a main userform Captureforumpost.PNG. I have companies that may have different divisions, so I added a second userformCaptureforumpost2.PNG 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. forumpost3.PNG
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
]
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Forum statistics

Threads
1,213,563
Messages
6,114,329
Members
448,564
Latest member
ED38

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top