- VIDEOS HOME PAGE
- .NET (14)
- Business Intelligence (40)
- Integration Services (19)
- Macros and Programming (82)
- Microsoft Excel (70)
- Microsoft Office (92)
- Miscellaneous (1)
- Power BI (35)
- Power Platform (35)
- Python (31)
- Report Builder (107)
- Reporting Services (113)
- SQL (42)
- Visual Basic for Applications (215)
- Visual C# (14)
- Excel VBA - Basics (24)
- VBA User Forms (22)
- Excel VBA - pivot tables (9)
- Excel VBA - charts (6)
- VBA - advanced (14)
- VBA - working with files (12)
- VBA - linking applications (12)
- VBA - working with Outlook (14)
- Built-in VBA functions (9)
- VBA - working with data (57)
- VBA - scraping websites (25)
- VBA - working with shapes (5)
- VBA - classes and structures (6)
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
- How do I control different cells with one spin button in Excel?
- How do I add a Select All option to a VBA List Box?
VBA User Forms videos | Excel VBA Forms Pt 17 - Editing Data
Posted by Andrew Gould on 18 April 2016
User forms aren't just for data entry; you can use them to edit and delete data too! This video explains how to create a form which allows the user to browse a set of records held in a worksheet and to edit and delete that data using the form. Along the way, you'll learn about a couple of advanced programming techniques such as declaring Enumerations and Property statements.
This video has the following accompanying files:
|Profitable Films.xlsm||Excel workbook with macros|
Click to download a zipped copy of the above files.
There are no exercises for this video.
Making a video bigger
You can increase the size of your video to make it fill the screen like this:
Play your video (the icons shown won't appear until you do), then click on the full screen icon which appears as shown at its bottom right-hand corner.
When you've finished viewing a video in full screen mode, just press the Esc key to return to normal view.
Improving the quality of a video
To improve the quality of a video, first click on the Settings icon:
Make sure you're playing your video so that the icons shown appear, then click on this gear icon at the bottom right-hand corner.
Choose to change the video quality:
Click on Quality as shown to bring up the submenu.
The higher the number you choose, the better will be your video quality (but the slower the connection speed):
Don't choose the HD option unless you have a fast enough connection speed to support it!
Is your Wise Owl speaking too slowly (or too quickly)? You can also use the Settings menu above to change your playback speed.
Thank you so much for this amazing Userform Tutorials, I just need to ask you, from your experience, what is the recommended number of Controls shall be used in a Single Userform?
I don't think that there is a definitive answer to that question. Add as many controls as you need to allow your users to provide the inputs they need. There are several ways to separate controls to reduce the number that are visible at the same time, as we've discussed in other comments.
I hope that helps!
1. I have alot of controls in the user form which makes it very large and messy, can I split them into related multi page control? or multi user forms?
2. Can a mulitpage control shows or hide another multipage control? is this a recommended approach?
3. If the user is required to enter almost 22 data entry for just one record? shall I split them into related multi page control? or not to use a user form at all and use direct excel sheet in VBA?
You can certainly split controls using a multi page on the form. There is a video in this series on working with multi page controls.
You can embed a multi page control within a multi page control, or show/hide a multi page control programmatically, or divide your form into separate forms, or just use a worksheet with embedded controls instead. I think that you and your users have to decide on the best approach - what makes life easiest for your users?
I hope that helps!
Hi Andrew ... your excel userforms videos are amazing, I have actually learned alot from you.
I just have a small question to you, I need to make a small tool that depends on entering more that 200 records ... is it effecient to let the user to enter the 200 records manually in a userform like the Film Detais Userform or is there any other mechanism.
Another thing if I will do some calculations and generating some reports as per the User Inputs ... shall I need to use userforms or just use the Excel Vba along with ActiveX Controls?
Thank you so much
I think that entering 200 records manually will take a long time whichever method you choose. I would probably not use a user form for this and rely on the user entering data directly into a worksheet. This will allow them to take advantage of copy and paste and the autocomplete feature to speed up data entry. You can use Data Validation to control what values the user enters into specific cells.
I don't think that you need user forms to create reports either - it will almost certainly be easier to provide buttons on the worksheet.
I hope that helps!
Many thanks for the response. On a quick first read it looks as if that is exactly what I need and looks to be simpler and more elegant than the changes I was planning to make.
I am currently sitting on a boat in Croatia so I won’t get a chance to give this a try until I am back home, but I will do so as soon as I can. I hope that revisiting past code did not take up too much of your valuable time.
Once again many thanks,
Many thanks for all the excellent videos. I have been using them to add to my knowledge of VBA.
I have been using the downloaded file accompanying this video as a basis of a project for myself (personal) as a stock system for my model collection. Many of my controls are combo boxes from standard lists. The basic work very well, but I hit on the idea of adding an extra page containing duplicate combo boxes and using these as a basis to set filters. This works OK and a simple subroutine filters the data in the main worksheet. However your "NavigateToRecord" ignores the filters and displays all the hidden rows.
I have started building a single element array to hold the row numbers of the visible rows which works OK, and I am about to write a different sub to replace your navigation routine. However I wondered of there was a slick way your routine could be made to ignore the hidden rows? If so this could save a lot of work.
As this video is now 2 years old, not sure if you will pick this up but thanks in anticipation.
If I had to do this I'd probably use a collection to hold the visible ID cells and populate this when the form is loaded. At the top of the form's code page you could add this:
Private VisibleIDCells As Collection
Private Sub PopulateVisibleIDCells()
Set VisibleIDCells = New Collection
Dim r As Range
For Each r In wsFilms.Range("A3", _
VisibleIDCells.Add r, r.Address
You can then make a call to the PopulateVisibleIDCells subroutine in the Initialise event of the form.
You'll also need to modify the way the RecordCount property works:
Private Property Get RecordCount() As Long
RecordCount = wsFilms.Range("A3", _
At the beginning of the ReadDetails subroutine, you'll need to change the way you set a reference to the current ID cell:
Private Sub ReadFilmDetails()
Set CurrentIdCell = VisibleIDCells(CurrentRecordId)
I haven't tested this rigorously (it took long enough to remind myself what I'd done in the first place!) but the basics appear to work when I apply different filters to the list of films.
I hope that points you in the right direction!