Word Document Properties


Figure 3-3: Stop or pause the macro recording process as necessary. 58 Part II: Learning the Ropes



Download 8,82 Mb.
Pdf ko'rish
bet60/207
Sana16.03.2022
Hajmi8,82 Mb.
#496217
1   ...   56   57   58   59   60   61   62   63   ...   207
Bog'liq
VBA For Dummies 5th Ed.pdf ( PDFDrive )

Figure 3-3:
Stop or
pause the
macro
recording
process as
necessary.
58
Part II: Learning the Ropes 
08_046500 ch03.qxp 12/5/06 5:34 PM Page 58


4. Make any required macro changes.
5. Save the macro and close the Visual Basic Editor.
Figure 3-5:
You use the
Visual Basic
Editor to
modify any
macros you
create using
the Macro
Recorder.
Figure 3-4:
The Macro
dialog box
contains a
list of
available
macros.
59
Chapter 3: Writing Structured VBA Programs
08_046500 ch03.qxp 12/5/06 5:34 PM Page 59


It isn’t necessary now to understand the macro shown in Figure 3-5. However,
this macro begins by assigning a value of 1 to the worksheet cell at A1. Because
the cursor was already in cell A1 when the macro recording started, this
action doesn’t appear in the macro. This omission points out one of the rea-
sons you want to edit macros you create with the Macro Recorder. The macro
then moves the cursor to cell B2 and assigns it a value of 2. Finally, the macro
moves the cursor to cell C3 and enters an equation in it that sums the two
numbers. You’d probably edit this macro by adding the missing cell reference
for A1, adding comments, and removing the one extra statement, as shown in
Figure 3-6.
Using Subs
I use a sub-procedure, or 
Sub
, in Chapter 2. A 
Sub
is the easiest method of
packaging code, and it’s the only packaging method that appears in the
Macro dialog box. In fact, the example in the “Writing Your First Function”
section (later in this chapter) demonstrates this feature. Consequently, the
one place where you always use a 
Sub
is the main entry point for a program
unless the program is a utility that you use only for programming purposes.
A second way to use a 
Sub
is to perform a task and not receive a direct
return value. You can use a 
Sub
to display an informational message, such as
the ones in Chapter 2. A 
Sub
can modify information in a number of ways; it
Figure 3-6:
Editing
Macro
Recorder
output is
important
when you
want to use
the macro
for multiple
tasks.
60

Download 8,82 Mb.

Do'stlaringiz bilan baham:
1   ...   56   57   58   59   60   61   62   63   ...   207




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish