This one is driving me crazy, so any help would be very much appreciated.
I have a template that allows the user to create a worksheet for tracking a series of bond investments. When they want to add a new bond, they click a command button that calls a userform (NewBondUserForm) for entering the details of the bond - this then calculates the # of bonds to buy and asks if they'd like to add it to the holdings. If they click yes, it calls a second userform (BondAddUserForm) that asks how many bonds they will actually purchase and then adds them into the holdings.
I'm trying to get this second userform's labels to show the max number of bonds they CAN add as well as the issuer. Both of these data points are held in cells on the activesheet. But no matter what I do the two labels are showing up as blank.
Here's the portion of the code that calls the second userform from within the first:
answer = MsgBox("You can purchase up to " & BondNum & " of these Bonds. Add to Ladder?", vbYesNoCancel, "Results")
Select Case answer
Case 7
Unload NewBondUserForm
Exit Sub
Case 6
Call BondAddUserForm_Initialize
Case MsgBoxResult.Cancel
Unload NewBondUserForm
Exit Sub
End Select
And then the code for the second userform's initialize, also stored within the first userform's code:
Private Sub BondAddUserForm_Initialize()
'***********************Open BondAddUserForm to Finalize Data for Bond Purchase***********************************************
Dim IssuerCap, BondNum As Variant, WS As Worksheet
Set WS = ActiveSheet
IssuerCap = WS.Range("O2")
BondNums = WS.Range("O7")
BondAddUserForm.Show
'Remind user of issuer and suggested purchase number
BondAddUserForm.Label1.Caption = "You are adding a " & IssuerCap & " bond to the ladder"
BondAddUserForm.Label2.Caption = "You can add up to " & BondNum & " bonds to the ladder"
End Sub
Thanks in advance for any advice!!!!
Bookmarks