Thanks for the input - I used F8 (unaware of that function, super-useful) and cleaned up a bunch of the code on the first userform as a result. I made all the variables I was storing in cells on the activesheet public and still set them via the first userform.
The reason I was using the second userform is twofold: First, the data on the first userform needs to be run through some calculations to recommend a number of bonds to buy (this may be more or less than the target value established earlier in the process depending on the bond price). Second, if the user is targeting, say, $10K in bonds for 2022 maturity, but there are only $5K available to purchase, I need to be able to get that input from the user and adjust the spreadsheet accordingly.
The first userform code ends like this (using .show as you suggest):
If Taxable.Value = "True" Then
TaxIssue = "Taxable"
MaxNum = Application.WorksheetFunction.RoundDown(TargetValue / BondPriceValue, 0)
Else
TaxIssue = "Muni"
MaxNum = Application.WorksheetFunction.Floor(TargetValue / BondPriceValue, 5)
End If
Investable = BondPriceValue * MaxNum
'Provide suggested number of bonds to add to ladder. Ask user if bonds to be added, and if answer is Yes, provide userform for finalizing entry into bond ladder.
BondAddUserForm.Show
End Sub
And then this is the code for the second userform:
Private Sub BondAddUserForm_Initialize(IssuerTxt, TaxIssue, Coupon, BondPriceValue, MaxNum, Investable, TargetValue, MaturityYear)
'*********************************Open NewBondUserForm to Gather New Data for Bond Purchase**************************************************************
'Remind user of issuer and suggested purchase number
Label1.Caption = "You are adding a " & IssuerTxt & " bond to the ladder"
Label2.Caption = "You can add up to " & MaxNum & " bonds to the ladder"
BondAddUserForm.Show
End Sub
Still not getting the captions to pop up. All the variables then push through correctly to the calculations that are made when clicking "OK" on the BondAddUserForm. The only issue is the lack of captions showing up on the BondAddUserForm...
Many thanks again.
Bookmarks