If then text from 1 userform to add text to userform 2 as Textbox entry

DThib

Active Member
Joined
Mar 19, 2010
Messages
464
Office Version
  1. 365
Platform
  1. Windows
Hi,

I plan to have a multi-layer workbook with User Forms passing an "If, Then" argument text answer from UserForm1 to UseForm2 TextBox after UserForm1 pulls data and closes.

What am I missing?

UserForm1:
Code:
Public Fi As String

Private Sub LEVEL1_CB_Click()
 
 'Dim Fi As String
 
   'Fi = UserForm2.MLevelTB.Value
   If True Then


      Fi = "Initial Look"
      MsgBox " This will place GUI at depth for Monday meeting", vbInformation + vbOKOnly, "Setting Level of Depth of Entry..."
     'Pulling data
      Call GetWorkbook
      Call WholeEnchilada
      
   End If
   UserForm2.Show


End Sub:

UserForm2:
Code:
Private Sub MLevelTB_Change()

 'Dim Fi As String
 
    If MLevelTB.Value <> "" Then
    Else
      MLevelTB.Value = Fi
    End If


End Sub
 
Last edited:

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
FYI,

The initial Form has three buttons that will fill out the text differently.

DThib
 
Upvote 0
I guess what I was trying to communicate was that line of code makes no sense. Some condition or variable value can be true/false. As coded, U have nothing to evaluate to true/false. I have no idea what it is that U want to evaluate? I'll guess...
Code:
If UserForm2.MLevelTB.Text = "Initial Look" then
HTH. Dave
 
Upvote 0
Hello Dave,

The basic theory is:
The first userform (UserForm1) sets the expectation of a meeting that occurs 3x every week. The first instance sets a high level view and the remaining delve further into the issue as the week progresses.
The data is pulled from a database query just before UserForm2 is fired.
The detail for the information is different depending on the meeting. The added information is captured with the 2nd userform(UserForm2).

The answer from the UserForm1 command button chosen takes the answer it will generate (i.e., "Initial Look") to support the coding I am writing to UserForm2. Take the answer of 1st, 2nd, or 3rd command button in UserForm1, and set the information to pull into a UserForm3 to interact with and save to designated worksheet in the workbook.

The code I posted is set to a UserForm1 and needs to take the result of the command button pushed to generate the text associated and place in the textbox(MLevelTB) in UserForm2 to be used in creating the right information to be pulled from the data.

Does that help?

Dthib
 
Upvote 0
Code:
Private Sub LEVEL1_CB_Click()
 Fi = "Initial Look"
UserForm1.MLevelTB.Value = F1
MsgBox " This will place GUI at depth for Monday meeting", vbInformation + vbOKOnly, "Setting Level of Depth of Entry..."
 'Pulling data
Call GetWorkbook
Call WholeEnchilada
Unload Userform1
UserForm2.Show
End Sub
Module code....
Code:
 Public F1 as String
Not real sure that I know what U want. I don't see any need for an If statement if all 3 command buttons do different things? The above code would be for 1 of your command buttons. Note that your "F1" variable needs to be placed as a Public variable in module code in order to be available to all of your userforms. HTH. Dave
 
Last edited:
Upvote 0
You are tall, strong and good looking!

Thank you. That fixed it. I think I was over thinking the solution.
You were a wonderful help.

DThib
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

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