Userform Question

ryan_law2000

Well-known Member
Joined
Oct 2, 2007
Messages
738
I have a userform that you need to fill in 4 sections then press a transfer button

How can i make it so that all four fields must be filled in before the transfer button runs.

If i dont fill in a cell and press the button i would like a MSG BOX to appear saying "All fields must be filled in"

how can i do this: here is the code already found on the transfer button


Private Sub CommandButton1_Click()
Dim i As Long
For i = 1 To 4
Sheets("SHELL OUT").Cells(Rows.Count, i).End(xlUp).Offset(1) = Me.Controls("TextBox" & i).Value


Next i
Unload Me
End Sub
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Example:

Code:
Private Sub CommandButton1_Click()
    With TextBox1
        If .Text = "" Then
            MsgBox "Please complete " & .Name
            .SetFocus
            Exit Sub
        End If
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,739
Members
448,989
Latest member
mariah3

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