Excel VBA Introduction Part 26 - Constants and Enumerations (Const, Enum)

  Рет қаралды 63,979

WiseOwlTutorials

WiseOwlTutorials

10 жыл бұрын

If you'd like to help fund Wise Owl's conversion of tea and biscuits into quality training videos you can click this link www.wiseowl.co.uk/donate?t=1 to make a donation. Thanks for watching!
You can buy our Introduction to Excel VBA book here www.lulu.com/shop/andrew-goul...
By Andrew Gould
www.wiseowl.co.uk - Constants in VBA are values which don't change - there are lots of built-in examples and you can also create your own. This video teaches you how to declare and use constants in your VBA procedures. You'll also learn how to create collections of constants called Enumerations, how to reference them in your code and also how to use them as a new data type for variables and parameters of procedures.
Visit www.wiseowl.co.uk for more online training resources in Microsoft Excel, Microsoft Access, Microsoft PowerPoint, Microsoft Word, Microsoft Project, Microsoft Publisher, Microsoft Visio, SQL Server, Reporting Services, Analysis Services, Visual Studio, ASP.NET, VB.NET, C# and more!

Пікірлер: 45
@houstonvanhoy7767
@houstonvanhoy7767 3 ай бұрын
Andrew: This video just blows my mind! Thanks.
@WiseOwlTutorials
@WiseOwlTutorials 3 ай бұрын
Happy to hear you enjoyed it!
@jmathew6988
@jmathew6988 Жыл бұрын
Excellent Tutorial! Best part is the the examples used. Gives you 200% understanding of the topic, if not more. Thank you.
@WiseOwlTutorials
@WiseOwlTutorials Жыл бұрын
Thanks J!
@khalidalisawi8037
@khalidalisawi8037 2 жыл бұрын
great tutorial, When I see it. and left all videos which I followed before and follow you
@WiseOwlTutorials
@WiseOwlTutorials 2 жыл бұрын
Thank you Khalid!
@adamderose9468
@adamderose9468 8 жыл бұрын
Great tutorial; very easy to understand and in-depth at a good pace for me. I coded along and replayed tons of times.. this and the Arrays tutorial has helped me broaden my beginner's skill set. Thank you!
@maksimaisin743
@maksimaisin743 7 жыл бұрын
Best VBA totur ever! Thank you very much WiseOwl, and many thanks to Andrew personnaly!
@timusolds3537
@timusolds3537 10 жыл бұрын
Dear WiseOwl!!! Thank you very much for you videos!!! Many thanks from KZ and DE!!! Your Videos are just awesome!!! Thanksssss!!!!!!!!!!!!!! A
@SyedKollol
@SyedKollol 10 жыл бұрын
This is the first time I really liked any video on these particular topics. Excellent work and thanks a lot.
@abdulnayazh2366
@abdulnayazh2366 9 жыл бұрын
All your videos are awesome man thanks....
@vk452937
@vk452937 7 жыл бұрын
Excellent videos. Thank you for the tutorials.
@tomash9785
@tomash9785 9 жыл бұрын
Oh yeah finally easy to follow video after tougher ones :)
@MagnusAnand
@MagnusAnand 8 жыл бұрын
Excellent video!!
@nazaserh
@nazaserh 3 жыл бұрын
Simply brilliant 👏
@WiseOwlTutorials
@WiseOwlTutorials 3 жыл бұрын
Thank you Serge!
@Gk2810_
@Gk2810_ 8 жыл бұрын
very informative ... it helped me a lot ..
@adambooth3858
@adambooth3858 9 жыл бұрын
Great tutorial. Thanks.
@Tan_Rainbow
@Tan_Rainbow 3 жыл бұрын
Excellent videos
@thomasfergusen5144
@thomasfergusen5144 4 жыл бұрын
great series
@tanmoyd
@tanmoyd 8 жыл бұрын
Very informative video - I can't stress it more! Can you please do a video on Constants, Variables and Enums while using VBA for PowerPoint? I really need to know. I am experiencing issues while using Constants for Colors in PowerPoint VBA.
@tanmoyd
@tanmoyd 8 жыл бұрын
+WiseOwlTutorials Thanks a lot! I understand :)
@AmitSharma-po1zb
@AmitSharma-po1zb 5 жыл бұрын
Simply Awesome... :)
@WiseOwlTutorials
@WiseOwlTutorials 5 жыл бұрын
Thanks Amit!
@SemperFiParatus
@SemperFiParatus 7 жыл бұрын
I'm loving your tutorials. They are informative and accurate. I personally think that if you reinforced your examples by including features learned in earlier models that you'd have a greater following. In every video so far you have failed to use the the [Procedure View] / [Module View] buttons in the bottom left corner of the VBE which really helps me focus on the task at hand by hiding separate modules. The following function would have done the exact job you wanted in the circle example. I am surprised you never used it: WorksheetFunction.Pi Brilliant work so far!
@SemperFiParatus
@SemperFiParatus 7 жыл бұрын
It's great! The resource is really helping me improve my skills. It would be rgeat to have a set that demonstrates how to build an excel application using VBA so that users can see something built from scratch that has a real world function and is useful like an accounting program that does double entry T accounts. Students would be able to recode it to their needs and learn how valuable VBA is to their job. Your teaching style is brilliant.
@danielpenteado
@danielpenteado 9 жыл бұрын
You rock!! Thks!
@DittoGlen
@DittoGlen 9 жыл бұрын
In regards to Pi constant, WorksheetFunction.Pi is also available (at least Excel 2010 its there)
@pallikishor
@pallikishor 6 жыл бұрын
Hi Andrew, I have got stuck at one point , need your help. actually I want to pass variable name through cell reference in sheet. If that variable is present in the declared list of the module then corresponding value should come into the reference cell. can we acheive it anyway? If yes ,Please guide me. It will be really helpful. Thanks in advance.
@krn14242
@krn14242 9 жыл бұрын
Thank you
@IndiaDefenceWing
@IndiaDefenceWing 3 жыл бұрын
I follow your every single video. Currently I am struggling with UIAutomation in VBA. Could you please create some videos on it and help me with any material if available.
@WiseOwlTutorials
@WiseOwlTutorials 3 жыл бұрын
Hi Sunil, I don't have any experience with UI Automation so it's unlikely that we'll have any videos on that topic, sorry!
@IndiaDefenceWing
@IndiaDefenceWing 3 жыл бұрын
@@WiseOwlTutorials Thanks Andrew. The best part about you is you always reply. Thanks Andrew and keep up the excellent work. It encourages us as well to learn beyond limits.
@WiseOwlTutorials
@WiseOwlTutorials 3 жыл бұрын
@@IndiaDefenceWing Thank you Sunil, I appreciate the support!
@scotolivera8207
@scotolivera8207 4 жыл бұрын
Thanks a lot.
@WiseOwlTutorials
@WiseOwlTutorials 4 жыл бұрын
You're welcome, thanks for watching!
@mahdjoubsofiane4005
@mahdjoubsofiane4005 3 жыл бұрын
As usually fantastic style of description I have only one question : What is the key difference between enumerations and collection ! And many thanks in advance
@WiseOwlTutorials
@WiseOwlTutorials 3 жыл бұрын
Thank you Mahdjoub! There are many differences between enumerations and collections. You might find the video on collections useful here kzfaq.info/get/bejne/bsxyiLiE19PXgGg.html I hope it helps!
@victoropere2107
@victoropere2107 6 жыл бұрын
awesome
@stephenhammond1745
@stephenhammond1745 Ай бұрын
I have started using enums and classes and find they make coding easier. Wondering if it is possible to use an enumeration in a WITH statement. Eg Define an enum named Address and then say With Address....? Is this possible?
@WiseOwlTutorials
@WiseOwlTutorials Ай бұрын
Hi Stephen! Unfortunately not, an Enum is just a set of related constants. A With statement needs to work with an object. You could use a Type to do the sort of thing you need. A basic example would look like this: Public Type Address Street As String Town As String Postcode As String End Type Sub With_Address() Dim a As Address With a a.Street = "Some street" a.Town = "Some town" a.Postcode = "AB12 3CD" End With End Sub You could use an Enum to set the datatype of one of the members of the Type like so: Public Enum CountryEnum Australia = 1 UnitedKingdom = 2 UnitedStates = 3 End Enum Public Type Address Street As String Town As String Postcode As String Country As CountryEnum End Type Sub With_Address() Dim a As Address With a a.Street = "Some street" a.Town = "Some town" a.Postcode = "AB12 3CD" a.Country = UnitedKingdom End With End Sub I hope it helps!
@stephenhammond1745
@stephenhammond1745 Ай бұрын
@@WiseOwlTutorials Ok. I had read somewhere that enums were technically considered objects but maybe that's not true or they just can't be used like other objects. I've just started looking into Types....still fairly new at this (68, retired, and using VBA as a way to keep my brain engaged). Thanks a lot for taking the time to reply. Your feedback/suggestions are very helpful.
@WiseOwlTutorials
@WiseOwlTutorials Ай бұрын
@@stephenhammond1745 It's super impressive that you're in to class modules and types already - it took me ages to wrap my head around those when I was getting started!
@stephenhammond1745
@stephenhammond1745 Ай бұрын
@@WiseOwlTutorials I took me a while to understand that these were aids to coding rather than ways of gathering user input when the code was running. Once I realized that, using them was fairly easy. Now it's more a matter of deciding which to use in any particular case.
@artistryartistry7239
@artistryartistry7239 Жыл бұрын
Why combine one concept people are trying to learn with something more complex like the area of a circle? Why not pick an example everyone understands intuitively, so they're not trying to learn the concept while dealing with additional unnecessary complexity? Why not use something like a tax rate or hours in a day, vs. Pi and area of a circle? Great tutorial, but keep it as simple as possible.
Excel VBA Introduction Part 11.2 - Application.InputBox
40:13
WiseOwlTutorials
Рет қаралды 131 М.
Cat Corn?! 🙀 #cat #cute #catlover
00:54
Stocat
Рет қаралды 15 МЛН
DAD LEFT HIS OLD SOCKS ON THE COUCH…😱😂
00:24
JULI_PROETO
Рет қаралды 13 МЛН
Now THIS is entertainment! 🤣
00:59
America's Got Talent
Рет қаралды 36 МЛН
Custom Enumerations in VBA
10:32
Jennifer Garth
Рет қаралды 2,9 М.
Better VBA 4 - Using Enums (Enumerations) in VBA
9:26
codekabinett.com/en
Рет қаралды 9 М.
Excel VBA Introduction Part 15a - Find and FindNext
22:58
WiseOwlTutorials
Рет қаралды 157 М.
Excel VBA Introduction Part 24 - File Dialogs
36:25
WiseOwlTutorials
Рет қаралды 77 М.
Excel VBA Introduction Part 36 - Using Class Modules in Other Projects
16:23
Enums(Enumeration): The Key to Cleaner, More Efficient VBA Code
9:58
Excel Macro Mastery
Рет қаралды 29 М.
Excel VBA Introduction Part 54.2 - The Switch Function
25:10
WiseOwlTutorials
Рет қаралды 16 М.
Cat Corn?! 🙀 #cat #cute #catlover
00:54
Stocat
Рет қаралды 15 МЛН