Databases Reference
In-Depth Information
there are 100 variables named XYValues, and each separate XYValues variable has two dimensions
(or indexes) that range in value from 1 to 10. Thus, these are some of the variables that compromise
the XYValues variable matrix:
XYValues(1,1) 'First Matrix Element
XYValues(3,7) 'In the middle range of Elements
XYValues(10,10) 'Last Matrix Element
serves one purpose. By default, the lower range of each
element in an array statement is 0. Thus, if the above declarations were not preceded by the statement
The statement
Option Base 1
, the number of elements for each dimension would increase by 1. For example:
Option Base 1
Option Base 0 'This statement is never necessary, it is the default
Public XYValues(10,10) as Single
creates a two-dimensional array with 121 elements (0 to 10
=
11 elements per dimension; 11
elements
statement is placed at the top of a
module to change the default lower index of all array elements to either 0 or 1.
×
11 elements
=
121 elements). The
Option Base
3.3
OPERATING IN EXCEL'S ENVIRONMENT FROM VBA
Chapter 1 was dedicated to the discussion of how to access data in Excel. That discussion was
focused primarily at the cellular level (i.e., access to individual cells within a Worksheet). In this
chapter, the discussion will focus on controlling and manipulating data at the Workbook and
Worksheet level within the Excel environment. Before a meaningful application can be constructed,
it is of paramount importance that the programmer understands how to gain access to Workbooks
and Worksheets within the Excel environment. At a minimum, the programmer must be able to
determine what Workbooks exist in the Excel environment at any given moment and the vital
parameters of each Workbook. Parameters such as (1) Is the Workbook visible or hidden? (2) How
many Worksheets does the Workbook contain and what are their names? (3) How many sheets in
a given Workbook are hidden and how many are visible? (4) Which sheets in a given Workbook
contain data and which are empty? (5) What is the extent to which a Worksheet is populated? Or,
in other words, how many rows and columns of data exist within a Worksheet?
Workbooks in Excel can easily be hidden from view by selecting W indow-> H ide from the
menu. Once this is done, the Workbook will still reside in Excel's memory, and all of the elements
of the Workbook (including any code or macros that reside in it) can be utilized from Excel VBA.
To unhide a Workbook, simply choose W indow->Unhide from the menu. A small dialog box will
pop up like that depicted in Figure 3.1, from which the Workbook to unhide can be selected.
FIGURE 3.1
Unhiding a Workbook in Excel.
Search WWH ::




Custom Search