View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Neal Zimm Neal Zimm is offline
external usenet poster
 
Posts: 345
Default Data Access Efficiency: Arrays versus Worksheet Data

Hi All,
In my app I have a worksheet, DataStore, with "validating" tables
of character and numeric data. It's hidden and the
data changes rarely.

As I wrote the function below, I cloned it from the code
that loads two arrays from DataStore, at workbook
open.
1) reserved worksheet names
2) Those in 1) that each workbook must have.

(The arrays are global public declared variables)
The code works fine, and I have not done any timings
yet, but I began to wonder, Why have the arrays at all ?

What are the pro's and cons of having the function below
go directly after the cells in DataStore versus checking
the arrays as it does now? With a computer of decent size,
I would assume that just about all the Excel data is in
memory anyway.
Thanks, Neal

Function zWsNames_AllReqdF(IWrkBkName As String) As Boolean
' Check a workbook to see if all required worksheets are there.
Dim Qty As Integer
zWsNames_AllReqdF = True
For Qty = 1 To UBound(RmRsrvWsNamesAy) 'reserved w/s names
' Exist/NotExist homegrown worksheet function
If NotExist = zWs_ExistF(IWrkBkName, RmRsrvWsNamesAy(Qty)) Then
If RMbReqdWsNamesAy(Qty) = True Then 'required sheets
MsgBox RmRsrvWsNamesAy(Qty) & " worksheet is missing from
workbook." _
, vbCritical, "Workbook: " & IWrkBkName & " Error"
zWsNames_AllReqdF = False
End If
End If
Next Qty
End Function
--
Neal Z