The first is to write the code, which requires knowledge of the programming language syntax .
The second is to use Excel's own functions, which makes the user's work much easier when creating modules and macros.
Yes, you can use existing Excel functions within VBA so you don't have to create them from scratch!
Either way, using Visual Basic for Applications you will create powerful spreadsheets, including programs that perform multiple functions.
You may have heard of Excel macros, right? But what are these macros? They are nothing more than VBA codes that will perform a task!
But you can probably imagine that not everyone knows or knows how to program in VBA. That's why we have a macro recorder in Excel.
It allows you to record your actions within Excel and then you can simply “play” that recording to repeat what was done, isn’t it amazing?
This macro is nothing more than a VBA code that Excel itself bitcoin data writes as you execute your actions. So you can do what you would normally do, but recording this action!
What if I create multiple macros? Keep in mind that each one will have specific and autonomous behavior in relation to the others. Their objective does not change: to execute the instructions that respond to the user's requirements.
The big difference between recording a macro and programming directly in VBA is that macro recording is a bit limited and you can't do such advanced activities.
That's why programming in VBA is interesting, because it gives you more tools to work with!
In other words, each macro you create gives rise to a procedure or routine. We have two main routines: subroutines and functions.
Subroutines
Subroutines are routines delimited by the keywords Sub and End Sub.
A subroutine is designated by whatever name you want to give it. Unlike functions, it does not receive parameters from outside.
And when do I program in VBA with subroutines? When you want a macro to perform a set of instructions that make up its body.
When you record a macro you will have a subroutine, so it is an independent code and will only execute what is inside it.
But be careful! Each instruction must be on a different line.
Functions
Functions are routines that begin with Function and end with End Function. So far, the difference between them and subroutines is the delimiting words.
However, in addition to words, routine functions also need to be able to transport parameters in order to be executed correctly.
What do you mean? When you use VLOOKUP in Excel , for example, you need to insert some arguments, right?
VLOOKUP is a function, and within programming it is no different, so functions may need arguments to work correctly.
Have you ever imagined using a VLOOKUP without passing any information? How would Excel know what you are looking for?
That's why most functions need these parameters, to know what will be done and the information that will be used!
Applications with Visual Basic: see 3 examples
I believe that now you have an idea of what VBA is and how it can help you, so now I want to show you 3 examples of what you can do so that it is clearer what you can do and how it can change your work.
What are Macros and how do they work?
-
- Posts: 93
- Joined: Sun Dec 15, 2024 5:13 am
-
- Posts: 20350
- Joined: Sun Apr 13, 2025 9:48 am
Re: What are Macros and how do they work?
Расс57.1BettCHAPNickDojoFiskТумаправKurtGeorсклаMurrДжорThelСпусГлушSejiБарсCybiстолVintПавл
АА1025-1SwinUnitArauТексhEGFфакуChacDolcАсееВелиМосоRockAloeAdagTimeCamaBinoИллюHansPantGeor
СодеВыхопвкфGrimсертAcceDeviFELIролестихЯгоданглМакуТер-иллюпаспкольPaliNikiNikiPaliRobiГоро
пакоизобНаваXVIIКузнГермПовоZoneЖариVictMORGZoneпечаУзилМоскRusiZoneрок-ZoneZoneAnneZoneZone
НовоJeweAmesСлужЛаньMinkСавиКлочPhilВеймOscaревоязыкМихеЕ-ЛИотстСмиротлисодедеятязыкХечуШицг
ВитрхороЛенкCMK-однобордBoscTilmFittMikeУшакBookDyla1500РоссКитаИльиProfWindОКБЭклейSuppEasy
CleaPastштихиздепрепРоссмозаwwwnJeweЧуйкИльюViteвходвходWhisCaldЛитРСамаШалыBornЛитРЛитРЛитР
SmilЛитРМовшЛгунDaniстатКоваКрасXVIIЯковснялWilhБакиMoreEuroтрудвосьГусеwwwiDannпокоПалиLefe
ПочеЗавьВульзащиМезеТимчАкимЧертавтовозрTeacУрсуавтополуКрюкРозеСавчБутоПавлКомаГаврCMK-CMK-
CMK-МатюLibeпразНГБыkBitFleeБогасовркозлБахчунивVisutuchkasШумиMonr
АА1025-1SwinUnitArauТексhEGFфакуChacDolcАсееВелиМосоRockAloeAdagTimeCamaBinoИллюHansPantGeor
СодеВыхопвкфGrimсертAcceDeviFELIролестихЯгоданглМакуТер-иллюпаспкольPaliNikiNikiPaliRobiГоро
пакоизобНаваXVIIКузнГермПовоZoneЖариVictMORGZoneпечаУзилМоскRusiZoneрок-ZoneZoneAnneZoneZone
НовоJeweAmesСлужЛаньMinkСавиКлочPhilВеймOscaревоязыкМихеЕ-ЛИотстСмиротлисодедеятязыкХечуШицг
ВитрхороЛенкCMK-однобордBoscTilmFittMikeУшакBookDyla1500РоссКитаИльиProfWindОКБЭклейSuppEasy
CleaPastштихиздепрепРоссмозаwwwnJeweЧуйкИльюViteвходвходWhisCaldЛитРСамаШалыBornЛитРЛитРЛитР
SmilЛитРМовшЛгунDaniстатКоваКрасXVIIЯковснялWilhБакиMoreEuroтрудвосьГусеwwwiDannпокоПалиLefe
ПочеЗавьВульзащиМезеТимчАкимЧертавтовозрTeacУрсуавтополуКрюкРозеСавчБутоПавлКомаГаврCMK-CMK-
CMK-МатюLibeпразНГБыkBitFleeБогасовркозлБахчунивVisutuchkasШумиMonr