VBA USER FORMS VIDEOS
- Excel VBA Forms Pt 1 - Drawing Forms
- Excel VBA Forms Pt 2 - Running and Navigating Forms
- Excel VBA Forms Pt 3 - Adding Code to Forms
- Excel VBA Forms Pt 4 - Validating Controls
- Excel VBA Forms Pt 5 - Validating Forms
- Excel VBA Forms Pt 6 - ComboBox Controls
- Excel VBA Forms Pt 7 - ListBox Controls
- Excel VBA Forms Pt 8 - Option Buttons
- Excel VBA Forms Pt 9 - Spin Buttons
- Excel VBA Forms Pt 10 - Scroll Bar Controls
- Excel VBA Forms Pt 11 - Check Boxes
- Excel VBA Forms Pt 12 - Toggle Buttons
- Excel VBA Forms Pt 13 - Image Controls
- Excel VBA Forms Pt 14 - Multi Page Controls
- Excel VBA Forms Pt 15 - Tab Strip Controls
- Excel VBA Forms Pt 16 - Playing YouTube Videos
- Excel VBA Forms Pt 17 - Editing Data
- Excel VBA Forms Pt 18 - Installing the Date Time Picker and Month View Controls
- Excel VBA Forms Pt 19 - The RefEdit Control
- Excel VBA Forms Pt 20 - Progress Bars
VBA User Forms videos | Excel VBA Forms Pt 5 - Validating Forms
Posted by Andrew Gould on 31 March 2016
Another aspect of validation is checking that every control on a form has been filled in. This video explains how to loop over the controls collection to check if every textbox has been completed.
You can download any files that you need to follow the video here.
You can increase the size of the video:
You can view the video in full screen mode as shown on the left, using the icon at the bottom right of the frame.
You can also increase the quality of the video:
You can improve the resolution of the video using another icon at the bottom right of the frame. This will slow down the connection speed, but increase the display and sound quality. This icon only becomes visible when you start playing the video.
Finally, if nothing happens when you play the video, check that you're not using IE in compatibility view.
First of all, THANK YOU for such brilliant quality videos! Andrew G. is the perfect balance of humor & guru! I have found each of these videos to be engaging, easily relatable and packed full of new information!
Onto my question...
I am building a userform to collect information into a workbook, very very similar to your examples with Films and the gross profits they made. HOWEVER, where your example had 3 input boxes, mine will have over 40 input boxes.
What would your recommendation be for an alternative to doing a similar action for each of the input boxes private subs? That is A LOT of repetiion and risk for missing an update. Is there a way to code the action once, but let it loop through each Private Sub?
Specifcially, I am trying to use the following code from the videos, but I dont want to copy paste and edit this over 40 times. The input boxes are labeled Criteria001 through Criteria045.
Private Sub AddToList_Button_Click()
If Criteria001.Value = "1" Or Criteria001.Value = "0" Or Criteria001.Value = "x" Then
MsgBox ProcessorName & "'s scores have been added to the Analyst Workbook."
Criteria001.BackColor = rgbPink
Criteria001Label.ForeColor = rgbRed
MsgBox "You must enter either 1, 0, or x."
Happy to hear that you've been finding the videos so useful! There certainly is a quicker way to vaildate multiple controls using a For Each loop. We do cover that technique in this video from around the 18:32 mark - this is definitely the approach to take if you hvae 40 text boxes to validate!