Hi, i am just starting to lear on how to use VB and i am wondering if you can help me in writting the correct code. I want a messagebox to show if any of the userform's textbox is empty or null. Submitter must fill all the details needed.![]()
Hi, i am just starting to lear on how to use VB and i am wondering if you can help me in writting the correct code. I want a messagebox to show if any of the userform's textbox is empty or null. Submitter must fill all the details needed.![]()
This is all the details needed IMHO.
![]()
Dim ctl As Control For Each ctl In Me.Controls If TypeName(ctl) = "TextBox" Then If ctl = Empty Then MsgBox "A text box is empty.", , "Missing Entry" Exit For End If End If Next ctl
Thank you! I tried updating it in my form and unfotunately i dont know were to place my code:
ActiveWorkbook.Sheets("VT Data").Activate
Range("A1").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value = TextRemedyID.Value
ActiveCell.Offset(0, 13).Value = TextRequestor.Value
ActiveCell.Offset(0, 12).Value = TextDateR.Value
ActiveCell.Offset(0, 15).Value = TextDateR.Value
ActiveCell.Offset(0, 11).Value = cmbTools.Value
ActiveCell.Offset(0, 14).Value = TextRef.Value
ActiveCell.Offset(0, 16).Value = CmbPOC.Value
Unload Me
ActiveWorkbook.Sheets("Voice Tracker").Activate
Range("A1").Select
Replace your above code with this...
![]()
Dim ctl As Control For Each ctl In Me.Controls If TypeName(ctl) = "TextBox" Then If ctl = Empty Then MsgBox "A text box is empty.", , "Missing Entry" Exit Sub End If End If Next ctl With Sheets("VT Data").Range("A" & Rows.Count).End(xlUp) .Offset(1, 0).Value = TextRemedyID.Value .Offset(1, 13).Value = TextRequestor.Value .Offset(1, 12).Value = TextDateR.Value .Offset(1, 15).Value = TextDateR.Value .Offset(1, 11).Value = cmbTools.Value .Offset(1, 14).Value = TextRef.Value .Offset(1, 16).Value = CmbPOC.Value End With Application.Goto Sheets("Voice Tracker").Range("A1") Unload Me
Thank you!! Now its working..... Appreciate your Help!![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks