Using two userforms

mnmhenry

Board Regular
Joined
Mar 28, 2002
Messages
169
Good morning all,

I have two userforms - Userform1 & Userform2

I open Userform1 and enter data. I then unlaod Userform1 and open Userform2 to enter more data - then my command to send the data to the excel sheet but only the data from Userform2 carries across to the spreadsheet?

Why am I missing Userform1's data as I unload both sheets before transferring the data?

Unload UserForm1
'(text input)

Userform2.Show
'(text input)
Unload UserForm2

Range("K7").Select
Selection.FormulaR1C1 = TextBox16.Text (Userform1)

Range("P7").Select
Selection.FormulaR1C1 = TextBox5.Text (Userform2)
 
This code will work with Next and Previous buttons.
Code:
Private Sub butNext_Click()
    With MultiPage1
        .Value = .Value + 1
    End With
End Sub

Private Sub butPrevious_Click()
    With MultiPage1
        .Value = .Value - 1
    End With
End Sub

Private Sub MultiPage1_Change()
    With MultiPage1
        butPrevious.Enabled = (0 < .Value)
        butNext.Enabled = (.Value < (.Pages.Count - 1))
    End With
End Sub
With only two pages, a single button would work, and the MultiPage_Change routine isn't needed.
Code:
Private Sub CommandButton1_Click()
    With MultiPage1
        .Value = (.Value + 1) Mod .Pages.Count
    End With
End Sub
 
Last edited:
Upvote 0

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Forum statistics

Threads
1,224,521
Messages
6,179,291
Members
452,902
Latest member
Knuddeluff

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