casethevariablenameal2009-09-01 07:51:52 楼主
thenenterthevariableasMyValuemixedcaseVBAchangesallotheroccurrencesofthe
variabletoMyValueAnexceptiontothisoccursifyoudeclarethevariablewithDimora
similarstatement;inthiswaysappearsasitwasdeclared

TheVBEditorscanstheinstructionforsyntaxerrorsIfitfindsanerroritchangesthe
colorofthelineandmaydisplayamessagedescribingtheproblemYoucansetvarious
optionsfortheVBEditorintheOptionsdialogboxaccessiblebychoosingToolsOptions

TipLikeExceltheVBEditorhasmultiplelevelsofUndoandRedoThereforeifyoufind
thatyoumistakenlydeletedaninstructionyoucanclicktheUndobuttonorpressCtrlZ
repeatedlyuntiltheinstructionreturnsAfterundoingtheactionyoucanchooseEditRedo
DeleteorclicktheRedoDeletetoolbarbuttontoredopreviouslyundonechanges

USINGTHEMACRORECORDER
AnotherwaytogetcodeintoaVBAmoduleistorecordyouractionsbyusingtheExcelmacro
recorderNomatterhowhardyoutryyoucannotrecordaFunctionprocedurethetypeof
procedurethatisusedforacustomwiorksehepetfunctionAllrecordedmacrosareSub
proceduresUsingthemacrorecordercanhelpyoutoidentifyvariouspropertiesthatyoucan
useinyourcustomfunctionsForexampleturnonthemacrorecordertorecordyouractions
whileyouchangetheusernameFollowthesestepsinExcel
ChooseDeveloperCodeRecordMacro
IntheRecordMacrodialogboxacceptthedefaultsettingsandclickOKtobeginrecording
TheRecordMacrobutton''scaptionchangestoStopRecording
ChooseExcelOptionsPopular
UnderthePersonalizeYourCopyofMicrosoftOfficeheadingchangethenameintheUserName
box
ClickOKtoclosetheExcelOptionsdialogbox













