ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Q setting up UserForm for filter criteria (https://www.excelbanter.com/excel-programming/292817-q-re-setting-up-userform-filter-criteria.html)

Ed[_9_]

Q setting up UserForm for filter criteria
 
I'm doing a repetitive AutoFilter. I have one macro that filters my
worksheet based on a series identifier. Then I have to filter for one or
more other criteria, and then do a text search, hiding rows that don't
match. To do another search, I have to reset the whole thing and go through
the whole filter process again.

Suddenly I think, I can streamline this if I can enter all my criteria in
one UserForm. Sounds good - but I've never done that before, and I'd like
to ask a couple of questions before I start. (I'm hoping to lessen the
number of brick walls to bang my head on!)

1. One filter criteria is a list of one or more of three items. This is
six possible combinations. Do I need six IF statements, one for each combo?
Actually seven, because none of the above is also valid; that column doesn't
get filtered.

2. Can I call a macro from an existing module? Or does all my code have to
be in the UserForm?

3. A couple of the existing macros I would call have their own
message/input boxes. Can I hide the UserForm to display these other boxes
without dumping the Form and its code out of memory?

TIA
Ed



Tom Ogilvy

setting up UserForm for filter criteria
 
1. One filter criteria is a list of one or more of three items. This is
six possible combinations. Do I need six IF statements, one for each combo?
Actually seven, because none of the above is also valid; that column doesn't
get filtered.

You decide - you are writing the code to set the filter - there is no
automatic link

2. Can I call a macro from an existing module? Or does all my code have to
be in the UserForm?

You can call code in general/standard modules from the event code in the
userform

3. A couple of the existing macros I would call have their own
message/input boxes. Can I hide the UserForm to display these other boxes
without dumping the Form and its code out of memory?

You can display the boxes over the userform (default behavior) or you can
hide the form, call the code, unhide the form. Hiding does not take the form
out of memory - unloading does.

--
Regards,
Tom Ogilvy



"Ed" wrote in message
...
I'm doing a repetitive AutoFilter. I have one macro that filters my
worksheet based on a series identifier. Then I have to filter for one or
more other criteria, and then do a text search, hiding rows that don't
match. To do another search, I have to reset the whole thing and go

through
the whole filter process again.

Suddenly I think, I can streamline this if I can enter all my criteria in
one UserForm. Sounds good - but I've never done that before, and I'd like
to ask a couple of questions before I start. (I'm hoping to lessen the
number of brick walls to bang my head on!)

1. One filter criteria is a list of one or more of three items. This is
six possible combinations. Do I need six IF statements, one for each

combo?
Actually seven, because none of the above is also valid; that column

doesn't
get filtered.

2. Can I call a macro from an existing module? Or does all my code have

to
be in the UserForm?

3. A couple of the existing macros I would call have their own
message/input boxes. Can I hide the UserForm to display these other boxes
without dumping the Form and its code out of memory?

TIA
Ed






All times are GMT +1. The time now is 12:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com