How to Customize Controls in Excel VBA

preview_player
Показать описание
👉 Ready to become a VBA Expert?
(Note: If the download page doesn't work then make sure to turn off any popup blockers)

How to Customize Controls in Excel VBA

In this video I cover how to use "With Events". This allows use to customize the behaviour of UserForm controls. This means we can create custom controls like a searchable dropdown.

#VBACustomevents #withEvents

Useful VBA Shortcut Keys
========================

Debugging:
Compile the code: Alt + D + L OR Alt + D + Enter
Run the code from the current sub: F5
Step into the code line by line: F8
Add a breakpoint to pause the code: F9(or click left margin)

Windows:
View the Immediate Window: Ctrl + G
View the Watch Window: Alt + V + H
View the Properties Window: F4
Switch between Excel and the VBA Editor: Alt + F11
View the Project Explorer Window: Ctrl + R

Writing Code:
Search keyword under cursor: Ctrl + F3
Search the word last searched for: F3
Auto complete word: Ctrl + Space
Get the definition of the item under the cursor: Shift + F2
Go to the last cursor position: Ctrl + Shift + F2
Get the current region on a worksheet: Ctrl + Shift + 8(or Ctrl + *)
To move lines of code to the right(Indent): Tab
To move lines of code to the left(Outdent): Shift + Tab
Delete a Line: Ctrl + Y(note: this clears the clipboard)
Рекомендации по теме
Комментарии
Автор

Thanks a lot. Class Module is so strong but not many person can explain as good as you.

Trucpq
Автор

Thanks Paul. You are one of my favourite teachers. I consider myself fortunate that you happen to teach a topic I have great interest in.

wizardofaus
Автор

You are genius. Definitely we want you to keep making such educational videos.

fahadsardar
Автор

Hi Paul, i would highly appreciate if you would create a video about writing own custom events outside of Userforms. Because i am curious about the benefits of creating own Events.

yeahnick
Автор

Again, this is an excellent explanation. I like every piece of information that you share. Thank you.🙂

iincitr
Автор

Paul - I normally use MS Access for my development, but I often follow your YouTube channel. By coincidence, the online Access Users Group recently had two demonstrations of WithEvents, so I was intrigued by your video. It took me a while to understand how to create an Excel User Form, but once I had it working, I was highly impressed by your work. I intend to see if I can implement the same concept in my Access projects. Thank you for posting.

jacksonmacd
Автор

Nice video. I like the stepped and structured way you explain advanced functions like withevents and classes. The demonstration in a practical application makes it even more stimulating to take the unsure step into trying something new that once mastered is so helpful. Great work! thanks.

astollie
Автор

This is awesome. Great man... I really enjoy your video... Basic fundamental explanations from scratch, then project build-up...

mmbcampus
Автор

Great video!! Thank you. I am happy to use VBA.

Excelcopilot
Автор

Excellent, I wish you can do more real samples like this one using Classes in the future, I have noticed most tutorials cover very simple examples with no real /practical use.

k
Автор

Great Video! So Usefull. A Suggestion for future videos is show some examples with custom controls with RaiseEvent method to create custom events, and how to deal with it in Form itself, when you use an array of objects.

edgarrocha
Автор

Nice! You are at another level with your code.

Rapture
Автор

Incredibly useful video. I've heard of using Withevents before, but your explanation somehow makes it more accessible and understandable. What I understand (but you did not explain explicitly) is, that the method you present does not inhibit the normal event calls in the userform itself.
I've been developing a userform application that has a lot of textboxes, comboboxes etc. So I decided to add a Help-textbox at the bottom of the userform that displays dedicated helptext. For this, I use the even _Enter(). That's indeed a lot of code that I can now replace with the class withevents. Thanks so much!

martinlenaerts
Автор

I love this and all your videos. Question, how did you add that "Statistics" button at around 15:55?

MagicOfMushrooms
Автор

wow! this is something worth learning! :)

kumarsharmaajit
Автор

Hello, thank you for the video. I need help, please
What should we do?
If the site requires you to log in first, then scrape the data from it after that

MoraTara
Автор

Now that's a nice Xmas present...Cheers Paul

peterwooldridge
Автор

Great video- class modules are awesome.
But I have a question 13:57 is it a good practice to use the i variable as long since only 9 values are stored. Is it better to use in this case "as Integer" or even "as Byte"?

chemikbezreakcji
Автор

Keep in mind that class that uses withevents must maintain its reference or the events will not fire.

If you had declared the class locally in a method then the event fires after that method exits the reference will be destroyed and the code you've bound to that event will not fire.

This has caused me hours of confusion and troubleshooting in the past so I figured I'd share it here.

ragnarok
Автор

Dear Paul, I usually use collection of Textboxes in Userform, my question is there any difference between Array and collection ?

AbdulRahmanSABRA
visit shbcf.ru