Supercharge Your Vba Skills With Subroutines And Functions!

TL;DR
This video explains the difference between subroutines and functions in Excel macros, as well as the usage of public and private variables.
Transcript
hello all welcome to the video in this video we are going to learn about different subroutines and different functions in excel macros as of now we have seen uh developer options and different types of controls form controls and activex controls in the in excel macros we have seen how to add a coding window um and how what's the difference between ... Read More
Key Insights
- 👨💻 The coding window in Excel macros is where you write VBA code.
- ↩️ Subroutines are used to execute code without returning a value, while functions can return a value.
- 🔒 Public variables can be accessed by multiple subroutines, while private variables are limited to a specific subroutine.
- 😒 It is best practice to use subroutines over functions in Excel macros.
- 🪜 Subroutines and functions can be added in modules or sheets.
- 🔒 When defining variables, choosing between public or private determines their scope of usage.
- 👻 Using public variables allows sharing data across multiple subroutines.
Install to Summarize YouTube Videos and Get Transcripts
Explore YouTube Video Summarizer or Get YouTube Transcript Extractor
Questions & Answers
Q: What is the difference between subroutines and functions in Excel macros?
Subroutines do not return any value and are used to execute code, while functions can return a value.
Q: How do you add a subroutine in Excel macros?
To add a subroutine, you need to open the coding window and use the syntax "Sub [subroutine name]". Code written inside the subroutine will be executed.
Q: Can functions be used instead of subroutines in Excel macros?
Yes, functions can be used, but subroutines are preferred. The hierarchy in Java is different, where functions are commonly used, but in Excel macros, we prefer subroutines.
Q: What is the difference between public and private variables in Excel macros?
Public variables can be accessed by multiple subroutines, while private variables are limited to the subroutine in which they are defined.
Summary & Key Takeaways
-
The video introduces the coding window in Excel macros and explains the need for subroutines and functions.
-
Subroutines are used to execute code and do not return any value, while functions can return a value.
-
Public variables can be accessed by multiple subroutines, while private variables are limited to a specific subroutine.
Read in Other Languages (beta)
Share This Summary 📚
Summarize YouTube Videos and Get Video Transcripts with 1-Click
Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator
Explore More Summaries from Ekeeda 📚






Summarize YouTube Videos and Get Video Transcripts with 1-Click
Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator