selecting worksheets

  • Thread starter Thread starter Matthew Kramer
  • Start date Start date
M

Matthew Kramer

I have an excel workbook and I'd like to run a procedure on all the
worksheets in the workbook, unless it is a worksheet called
"description" or "data". If it is one of these two worksheets, then the
program need do nothing. But if it is not one of these worksheets, then
the programme should run the procedure. What would be the right VB code
to do this?

On a separate note, I also have an excel worksheet called "filter" with
contains data info to run an advanced filter to extract from a larger
dataset. The data set with the info to run an advanced filter, for
example, is:

firstname lastname indexno.
Larry Reeves 77642
Mary Adams 98789
Nancy Hopper 76543

I'd like to use the above dataset to extract the full line of info from
the complete dataset which is on another worksheet called "full data" in
the workbook.

The complete data set in the "full data" worksheet is, for example:

firstname lastname indexno. address birthday
Larry Reeves 77642 40 Mohawk 1/19/70
Mary Adams 98789 10 Brook Lane 6/3/64
Nancy Hopper 76543 82 Farm Hill 4/22/73
(There'd also be a lot of other names and info in this data set, but I
would like to extract just the ones specified in the first smaller
dataset created to do the advanced filter)

How could I write the VB code to do this?

Thanks.

Matthew Kramer
 
Hi
for the first question try something like
sub foo()
dim wks as worksheet
for each wks in worksheets
if lcase(wks.name)<>"description" and _
lcase(wks.name)<>"data" then
'your code
end if
next
end sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top