M
Minitman
Greetings,
I am trying to pass data from one UserForm to another and then hide
the first one. So far, I can get UserForm2 (UF2) to come up, but
UserForm1(UF1) doesn't hide until I cancel out of UF2. Then I must
use the button on the sheet that originally brought up UF1 to unhide
it. For some reason, the code that I use to bring up UF2 does not
finish running!!! I tried to do UF1.Show in the Cancel button on UF2
and I got an error that said I could not show what is not hidden(?).
So I removed it.
I then put MsgBoxes between each line to track what was happening.
It gets past the 1st MsgBox to open UF2 and no further, until I close
out UF2, then the rest of the Msg's pop up. This is also when UF1
gets hidden as the code progresses!!!!
Here is the code:
Private Sub CalculateButton_Click()
MsgBox "Bring up UF2"
UF2.Show
MsgBox "Hide UF1"
UF1.Hide
MsgBox "Copy the 1st amount"
UF2.T1.Text = UF1.TB16.Text
MsgBox "Copy the 2nd amount"
UF2.T2.Text = UF1.TB8.Text
MsgBox "Copy the 3rd amount"
UF2.T3.Text = UF1.TB7.Text
MsgBox "Copy the 4th amount"
UF2.T4.Text = Val(UF1.TB11.Text)
MsgBox "Copy the 5th amount"
UF2.T5.Text = UF1.TB9.Text
MsgBox "Copy the 6th amount"
UF2.T6.Text = UF1.TB13.Text
MsgBox "Copy the 7th amount"
UF2.T7.Text = UF1.TB15.Text
MsgBox "Copy the 8th amount"
UF2.T8.Text = UF1.TB10.Text
MsgBox "Copy the 9th amount"
UF2.T9.Text = UF1.TB12.Text
MsgBox "Copy the 10th amount"
UF2.T10.Text = UF1.TB14.Text
End Sub
Any help would be appreciated.
TIA
-Minitman
I am trying to pass data from one UserForm to another and then hide
the first one. So far, I can get UserForm2 (UF2) to come up, but
UserForm1(UF1) doesn't hide until I cancel out of UF2. Then I must
use the button on the sheet that originally brought up UF1 to unhide
it. For some reason, the code that I use to bring up UF2 does not
finish running!!! I tried to do UF1.Show in the Cancel button on UF2
and I got an error that said I could not show what is not hidden(?).
So I removed it.
I then put MsgBoxes between each line to track what was happening.
It gets past the 1st MsgBox to open UF2 and no further, until I close
out UF2, then the rest of the Msg's pop up. This is also when UF1
gets hidden as the code progresses!!!!
Here is the code:
Private Sub CalculateButton_Click()
MsgBox "Bring up UF2"
UF2.Show
MsgBox "Hide UF1"
UF1.Hide
MsgBox "Copy the 1st amount"
UF2.T1.Text = UF1.TB16.Text
MsgBox "Copy the 2nd amount"
UF2.T2.Text = UF1.TB8.Text
MsgBox "Copy the 3rd amount"
UF2.T3.Text = UF1.TB7.Text
MsgBox "Copy the 4th amount"
UF2.T4.Text = Val(UF1.TB11.Text)
MsgBox "Copy the 5th amount"
UF2.T5.Text = UF1.TB9.Text
MsgBox "Copy the 6th amount"
UF2.T6.Text = UF1.TB13.Text
MsgBox "Copy the 7th amount"
UF2.T7.Text = UF1.TB15.Text
MsgBox "Copy the 8th amount"
UF2.T8.Text = UF1.TB10.Text
MsgBox "Copy the 9th amount"
UF2.T9.Text = UF1.TB12.Text
MsgBox "Copy the 10th amount"
UF2.T10.Text = UF1.TB14.Text
End Sub
Any help would be appreciated.
TIA
-Minitman