Displayed result in Form2 from CommandButton in Form1.

MissAugust

New Member
Joined
May 10, 2012
Messages
37
Dear Experts,
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> </o:p>
I have a worksheet which do data analyse. I am using two form here, where Form1 used to input data from textbox into excel, which successfully done.

What I want to do is to use CommandButton from Form1 (CMDSHOW) and the result in excel will show up in textbox in Form2. I have the result in P10 to show in textbox1, result in S10, S11, S12 to show in textbox2, textbox3, textbox4. Can someone please advise me? Thank you in advance.
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
code for the command button on Form1:

Code:
Private Sub CommandButton1_Click()
    Dim ws As Worksheet
    
    Set ws = Worksheets("Sheet1")
    
    Load Form2
    
    With Form2
        .TextBox1.Text = ws.Range("P10").Text
        .TextBox2.Text = ws.Range("S10").Text
        .TextBox3.Text = ws.Range("S11").Text
        .TextBox4.Text = ws.Range("S12").Text
    End With
    
    Form2.Show
End Sub
 
Upvote 0

Forum statistics

Threads
1,225,156
Messages
6,183,222
Members
453,152
Latest member
ChrisMd

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