It's goingtobe a greattraining, solet's getstarted.
Just a notebefore, I docreatetheseVBAbasictrainingseachandeverySaturday, alongwithTuesdaycompleteapplicationdevelopment, somakesureyoudogetsubscribedandalsoturnonthenotificationicon.
When I firststarteddeveloping, I didn't knowhowtonamethesemodules.
I wouldhavemodulesone, two, three, soifweinsertanotheronehere, andsonowwehavemoduletwo, and I didn't knowwhatwasinsideeach.
I wouldhavetoclickoneachjusttoknow, sothefirstthingyouwanttodo, especiallyifyou'regoingtobedeveloping a largerapplicationwith a lotofmodules, istonameyourmodule, andtodothat, youcangointothepropertieshere, orclick F4, andit's goingtolaunchthisproperties.
Nowthiswindowmaybesnappedhere, itmaybedownhere, itmaybesomewhere, dependinguponyourscreen, butwhatyouwanttodoisyouwanttogiveit a name.
Whatevertheapplicationyou'redevelopingis, let's say a customerapplication, wemightwanttodocustomermacros, right?
Sowehavedifferentmacros, maybewehave a schedulingmacro, andthensothefirstthingyouwanttodoisnameyourmodules, andthat's goingtomakethings a loteasier, solet's justdosomethinglikeschedulingmacros.
Alsowhenyou'renaming, wewanttomakesurethatweuse a combinationofcapitallettersandsmallerletters, solet's say I'lldocustomer, somethinglikeaddnew, andthenmaybewe'lldocustomer, andthenwe'lldosaveorupdate.
Nowoneofthethingsthat I like, let's dothesubfirst, nowwhen I wanttoaddthisnewcustomersomewhereelse, andif I'm inanothermodulehere, and I writesubschedule, andthenaddnew, somaybe I wanttoaddthatnewcustomer, and a goodwayif I wanttorememberit, I don't wanttonecessarilylookover, usingthecombinationoflowercaseanduppercaseisgoingtobereallyhelpful, becauseithelpsusletusknowwhenwehavetherightone.
Soif I typeinaddnew, youseehowitautomaticallygoestothecapitalletters, thepropernamehere.
However, if I getanythingwronginsidethename, somethinglikethis, and I goover, lookhowitdoesn't change, that's goingtotellmerightthere, I'vegotsomethingwrongwiththename, soitkindofhelpsus, wedon't alwayshavetolookback, sothattellsmerightthere, becauseitdidn't gotocapitalletters, I knowthat I mighthaveanissuewiththemacro, sothatkindofavoidserrors, andmakesthingsreallyclear.
Sowhenweactuallycreateourmacronames, wewanttouse a combinationofupperandlowercase, andthatwaywhenwewritethemout, andwe'reonanothermodule, wedon't quiteremember, wetypeinalllowercase, andwemakesurethatitgoestotheproper.
And I thinkthat's a reallycriticalcomponentbecausewhenwe'relookingatourcodeorsomebodyelseislookingatourcode, orevenifwe'relookingatourowncode, a fewyearslater, wewantittobevery, veryeasy.
Soonceagain, wecanalsousethevariable.
If I sayforcustomerrowequals 1 to 10, nextcustomerrow, again, see, I'm typinginsmallletters.
Ifitthengoestotheupper, I knowthat I'vegottherightvariable.
Soit's a greatway.
Soif I getitwrong, it's goingtotellmerightawaythatithasn't changedtheuppercasehere.
So I knowthatthere's somethingwrongwiththevariable.
Sonotonlyusingcorrectnames, butusing a combinationofupperandlowercasetohelpusquicklyunderstandthatmeansaswe'retypingthecode, weknowthatwe'vegotanincorrectvariableandthathappensallthetime.
Sowewanttousenotonlynamingthecorrectnamesandclearnames, butusing a combinationofupperandlowercaseorusingsometypeof a propernamesothatwecanquicklyseewhenwetypeincorrectvariables.
Andthathappenstome a lot, evenduringwhile I'm recording, I'lltypeanincorrectvariable.
Assoonas I movedtothelowerline, I seethatdidn't movetouppercase.
So I knowrightawaysomethingiswrongwithmyvariable.
Sothat's a greatwaytounderstandclearlyhowtoproperlynamevariables.
Anotherthingwewanttomakesureof, andlet's justsay, forexample, wehaveapplicationwherewe'vegot, let's say a customerlisthereandwegointotheformulasnamemanager.
Andlet's say I have a, let's goaheadandcancelthis.
I'm justgoingtocreate a newsheetrealquickly.
Andlet's saywehave a listofcustomernameshereand I'lljustputincustomernames.
Andlike I said, evenifnobodyisgoingtoseeyourcode, itishelpfulforyouandyourselfifyoucomebacktoyourcodeover a periodoftimetounderstandexactlywhatthecodeisdoingandwillhelpyoufinderrorsandunderstandabouttheapplicationdevelopment.
Soit's very, veryimportanttodothat.
Nowwecanusecommentingattheendof a specificcodeorwecanusecommentinginitsownlineandwecanuseasmanyapostrophesaswewant.
Wecanusecapitalletters, startloop.
Andalsowecanseethatthecolorshereofthatareingreen.
However, ofcourseyoucanchangethecolors.
Youcanchangeanythingyouwant.
Weseethedimensionsarein a darkblue.
Wecandothatusingourtoolshere.
Andthenwehavesomeoptionshere.
Ifwegointotheoptions, wegointotheeditorformat.
Andfromhereyoucanchangethecolorsofanythingelse.
Soweseethecommenttextisgreen.
If I weretochangethatto a differentcolorandthenclickokay, weseethatit's inpink.
Anotherwaytoautomateandspeedupyourcodedevelopmentandalsoincreaseaccuracyistouseanautomator, a codeautomator, orsomethinglikeAutoHotKeythatautomaticallyallowsyoutotypeincode.