ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,832
- Office Version
- 2007
- Platform
- Windows
The partial code below needs some advice help please.
On a userform the user completes textbox values but in this example when he runs the code on commandbutton1 he is asked which row the data should be inserted on the worksheet.
Then he is told all fields needs to be completed, he didnt add a value to say 1 textbox.
I am trying to swap it around so the code check that all fields are complete THEN as which row values should be inserted otherwise just dont ask that question until ALL fields are complete.
I did move the code in Red BEFORE the row question but kept getting an error message,simple but im not winning on this one.
On a userform the user completes textbox values but in this example when he runs the code on commandbutton1 he is asked which row the data should be inserted on the worksheet.
Then he is told all fields needs to be completed, he didnt add a value to say 1 textbox.
I am trying to swap it around so the code check that all fields are complete THEN as which row values should be inserted otherwise just dont ask that question until ALL fields are complete.
I did move the code in Red BEFORE the row question but kept getting an error message,simple but im not winning on this one.
Rich (BB code):
Dim i As Integer
Dim ControlsArr As Variant, ctrl As Variant
Dim x As Long
Dim z As Integer
z = CInt(Application.InputBox("WHICH ROW SHOULD DATA BE INSERTED INTO ?", "NEW CUSTOMER ROW NUMBER MESSAGE", Type:=1))
For i = 1 To 11
With Me.Controls("TextBox" & i)
If .Text = "" Then
MsgBox "ALL FIELDS MUST BE COMPLETED", 48, "GRASS NEW CUSTOMER FORM"
.SetFocus
Exit Sub
End If
End With
Next i