Defiitive Guide to Excel Training

Preview:

DESCRIPTION

Excel training

Citation preview

*1038_ch00_CMP3 6/21/03 12:59 PM Page iv

*1038_ch01_CMP3 6/21/03 10:43 AM Page 46

*1038_ch03_CMP2 6/18/03 4:48 PM Page 66

Sheets.Add Type:=xlChart

ActiveSheet.Name = "My Chart"

V b e 6 . d l l VBAi objecti librar yi Sdirector yiC o m m o n F i l e s \ M i c r o s o f t S h a r e d \V B A \ V B A 6 \ )

E x c e l . e x e Exceli objecti librar yi Sdirector yi

O f f i c e \ O f f i c e 1 0 .M s o . d l l MS\Officei objecti librar yi withi thei objectsi commoni toi alli Officei com\

ponentsi Sdirector yi

C o m m o n F i l e s \ M i c r o s o f t S h a r e d \ O f f i c e 1 0 .F m 2 0 . d l l MSi For msi librar yi fori creatingi Òintelligenti worksheetsÓi S Windows

systemidirector y.

S c r r u n . d l l MS\Scr iptingi runtimei librar yi withi FSOi objectsi fori convenient

accessi toi datai S Windowsi systemi director y.

M s a d o 2 1 . t l b ADOi LM0zobjecti librar yi fori databasei programmingi Sdirector y

C o m m o n F i l e s \ S y s t e m \ A d o .

End Property

f n a m e = T h i s W o r k b o o k . P a t h + " \ s c i e n t i f i c . t x t "

W o r k b o o k s . O p e n T e x t F i l e n a m e : = f n a m e , …

S e t n e w w o r k b = A c t i v e W o r k b o o k

n e w w o r k b . W o r k s h e e t s ( 1 ) . C o p y a f t e r : = T h i s W o r k b o o k . W o r k s h e e t s ( 1 )

n e w w o r k b . C l o s e F a l s e E n d S u b

� � � � � � � � � � � � � � � �

'example file function.xls;

Function NumberToText(x As Variant) As String

Dim i&, result As String, character$, lastchar&

Dim digit$(9)

digit(0) = "zero": digit(1) = "one": digit(2) = "two"

digit(3) = "threlIv^&n"DimxDsESurmxrelIv^&n5DimxDsEive"two"1^jn^4n"d6DimxDssixmxrelIv^&n7DimxDsseve "mxrelIv^&n8DimxDseig= "t"two"1^jn^4n"d9DimxDs "i= "o�two"1^jIf isEmpty(x) T= "e " NumberToTextimxDsCreExit Subtwo"

T h e C o m m a n d R e s u m eExitpSub

O

*1038_ch09_CMP2 6/20/03 11:37 AM Page 494

chartWSheet.[DailyMax].PasteSpecial xlValues

' create three charts

For i = 1 To 3

chartWSheet.ChartObjects.Add(30, 150 + 200 * (i - 1), 400, 185). _

Name = "Daily data " & i

chartWSheet.ChartObjects("Daily data " & i).Activate

If i = 1 Then

ActiveChart.ChartWizard protWSheet.[A3:D99], _

xlLine, 4, xlColumns, 1, 1

ElseIf i = 2 Then

ActiveChart.ChartWizard protWSheet.[A3:A99,E3:E99], _

xlLine, 4, xlColumns, 1, 1

ElseIf i = 3 Then

ActiveChart.ChartWizard protWSheet.[A3:A99,F3:F99], _

xlLine, 4, xlColumns, 1, 1

End If

Next i

' format charts

For Each chobj In chartWSheet.ChartObjectsts

0��������������������-��������2� <�����%��=�#��������'��� '������������0���C��������2� <��-%��=�#��������'��� '������������0���R��������2� <�����(���=�#��������'��� '������������0���""��������2� <��-(���=�#��������'��� '������������0���"E��������2� <��1)���=�#��������'��� '������������0���"L��������2� <�������=�#��������'��� '������������0���"D��������2� <�������=�#�$ ������$�*��������)���&�*�$3$�*��������0�

,�-����Chapter 11618

� � � $ " � : � � # ' � � ;

� � C �

� � � � �� �

$ � � � � � � � � � � � - � � � � � � � � � � � � � � � � � � � - � ! � � � ' � �

$ � � � - � � � . � A 5 � � �

$ � � � B = � � � 7

� � � � - � 1 � � 5 � . � A C A � . � A 5 � � � � 8 � � � � 8 �

� � � � " � � � � 8 � � H � ' � � 1 � � � � G � � Q � � � � ' C � M � + F 8 � P � D

8 $ � � � � � � � � � 1 8 � P � � 5 � . � A C A � � � � 5 � P � 8 & � - � � ' � � ' C 8

B � 1 � 8 � � � � � � � � � � � � � � � � � � � � � � � � 8 � 7 � D

8 ! " # � � � � � � � � " ! $ � ! � 3 4 � � � � � � � � � � � � � � � � � 8

� � � � " � � � � B � � � � �

. 5 � � � � � � � � � � � "

� � 1 � � � P � ;

- � R � ; S � � � � � � � 1 � � � � < � � � � � � � � P � 8 � � 8 � P � � � � < � � � � � � �

� � � � # H � � � : �

. � � '

*1038_ch12_CMP2 6/20/03 2:58 PM Page 686

Construction and Reconstruction of Existing Pivot Tables

eUfell

*1038_ch13_CMP2 6/20/03 3:40 PM Page 730

*1038_ch16_Appendix_CMP3 6/21/03 1:01 PM Page 878