View Single Post
  #21   Report Post  
Posted to microsoft.public.excel.misc
David
 
Posts: n/a
Default Use Named Range instead?

The loop I want wouldn't cycle through the whole list (all the patients
enrolled in our program) in AC, but only the names I select (my caseload)
from AC and apply a range name (myList) to. For each name in my caseload
(myList), PrintMine() would find only those names in A and print the
pages for only those patients.

Example:
ColAC
Name1 through Name100 (names only, no blanks, sorted alphabetically)
I select Name3, Name7, Name8, Name15, and Name21 (the discontiguous
range--my caseload) and apply a range name (myList) to that selection

ColA
Name1 followed by a list of classes
Name2 followed by a list of classes
Name3 followed by a list of classes
and so on through Name100

Each patient's page is set via horizontal page breaks

PrintMine() would loop through myList, finding each of those patients in
ColA and printing that patient's page.


Sorry this has been such a confusing exercise. I know you can't see my
screen.

--
David

Dave Peterson wrote

I was confused by this line:

Column AC is the one with names only, no blanks, sorted
alphabetically when added via an AddPatient() routine.


There was a disconnect between the no blanks in one of your posts and
the discontiguous range in others.

So is there anything else in Column AC except for each name and empty
cells?

If no, you could still pickup that range and loop through them:

dim myListRange as range
dim myCell as range
with whateversheet
set mylistrange = .range("ac1",.cells(.rows.count,"AC").end(xlup)
end with

for each mycell in mylistrange.cells
if isempty(mycell.value) then
'do nothing
else
'do the find
end if
next mycell