Supercharge Your Vba Skills With Subroutines And Functions! | Summary and Q&A

18 views
â€ĸ
August 20, 2023
by
Ekeeda
YouTube video player
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.

Install to Summarize YouTube Videos and Get Transcripts

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.

Transcript

Read and summarize the transcript of this video on Glasp Reader (beta).

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.

Share This Summary 📚

Summarize YouTube Videos and Get Video Transcripts with 1-Click

Download browser extensions on:

Explore More Summaries from Ekeeda 📚

Summarize YouTube Videos and Get Video Transcripts with 1-Click

Download browser extensions on: