Word Document Properties



Download 8,82 Mb.
Pdf ko'rish
bet103/207
Sana16.03.2022
Hajmi8,82 Mb.
#496217
1   ...   99   100   101   102   103   104   105   106   ...   207
Bog'liq
VBA For Dummies 5th Ed.pdf ( PDFDrive )

Figure 4-5:
The report
example
begins with
a few sim-
ple entries.
107
Chapter 4: Storing and Modifying Information
09_046500 ch04.qxp 12/5/06 5:54 PM Page 107


Listing 4-17
Designing an Excel Report
Public Sub CreateReport()
‘ Create some output variables.
Dim DataSum As Integer
Dim Output As String
‘ Begin by adding data to the report.
Sheet1.Cells(3, 2) = 1
Sheet1.Cells(4, 2) = 2
Sheet1.Cells(5, 2) = 3
‘ Create a sum of the cell content.
DataSum = Sheet1.Cells(3, 2) + _
Sheet1.Cells(4, 2) + _
Sheet1.Cells(5, 2)
‘ Create an output string.
Output = “The sum of the three numbers is: “ + _
CStr(DataSum)
Sheet1.Cells(7, 1) = Output
End Sub
The code begins by declaring two variables. The first, 
DataSum
, holds the
sum of the three data entries that the code creates. The second, 
Output
,
contains a string that holds the report summary. The worksheets in an Excel
file are objects, just like any other object. You access the worksheet objects
by using the name assigned to them — 
Sheet1
in this case.
Worksheets contain 
Cells
objects. Each 
Cells
object uses two numbers to
identify its row and column. You can assign a value to the cell by using the 
=
operator as shown in the code.
It’s also possible to retrieve values from the 
Cells
objects. The code shows
how to use this feature to create a summation of the three numbers entered
as data on the worksheet.
The last two lines of code create a summary statement that includes the sum-
mation in 
DataSum
. Figure 4-6 shows the result of running this program.
108
Part II: Learning the Ropes 
09_046500 ch04.qxp 12/5/06 5:54 PM Page 108


Figure 4-6:
The Excel
report is
simple but
demon-
strates that 
you know
enough to
perform
simple
tasks.
109

Download 8,82 Mb.

Do'stlaringiz bilan baham:
1   ...   99   100   101   102   103   104   105   106   ...   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