View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Birley Dave Birley is offline
external usenet poster
 
Posts: 171
Default Deny in "Find" based on flag

Perhaps this is a better approach:

Dim varCodes As Variant
Dim blnReg As Boolean, _
blnOt As Boolean, _
blnCsl As Boolean, _
blnHol As Boolean, _
blnRot As Boolean, _
blnHld As Boolean, _
blnSbn As Boolean, _
blnPrf As Boolean, _
blnRpy As Boolean, _
blnCodes As Boolean
Dim intI As Integer
Dim strSearchList As String

Set varCodes = Array(blnReg, _
blnOt, _
blnCsl, _
blnHol, _
blnRot, _
blnHld, _
blnSbn, _
blnPrf, _
blnRpy)

strSearchList = ""
For intI = 1 To 9
' If the Flag blnReg is True, Then
' strSearchList = strSearchList + "REG"
' End If
' If the Flag blnCsl is True, Then
' strSearchList = strSearchList + "CSL"
' End If
' Etc.......
Next intI

???
--
Dave
Temping with Staffmark
in Rock Hill, SC


"JLGWhiz" wrote:

How much grief would it cause if you copied the data to new sheets and sorted
it so you didn't have to set the flags. You could just go down the column of
each sheet, repeating for each name.

"Dave Birley" wrote:

Try to visualize a WB with 32 WS. They consist of 4 years' worth of info each
in a set of 8 WS, being 2 WS for each quarter. (This is payroll data).

The information I am interested in has a code that could be one of nine
possible three-letter sets:

ABC, DEF, GHI, JKL

I need to extract the LATEST data for each code only once.

My plan is to start at the latest quarter (Q4, page2), find the person, and
once found (which might involve stepping back to page1), add up all the data
for the codes THAT I FIND. As I find each one, I need to trigger a flag that
says "ignore this 'code' as we go through the rest of the quarters and
pages", and then step back to the next quarter and repeat the "Find" for any
data I didn't catch so far.

I will have the WS names in an array. Is the way to do this to build a
two-dimensional array with the codes in one column, and a Boolean flag in the
other? Once the code is used, set the flag to False, and continue until all
the flags are False, then leave the whole search process, and reset all the
flags to True for the next search candidate.

I have the picture fairly clearly in my mind, and I have had the code
working previously where I only had to look for the codes in a single WS, and
this did involve stepping through the array of WS to find the dude that did
the dirty deed.

Looking for some guidance on this -- I think I'm getting close to the "deep
end" <g!
--
Dave
Temping with Staffmark
in Rock Hill, SC