Declaring Variables

C

chris brunt

I have a project with a couple of userforms and other
modules. One of the userforms applies a filter to a data
list in Excel. Under certain criteria I wish to remove the
filter (ActiveSheet.ShowAllData) and to avoid this code
being executed when the fiter has not been applied (which
produces an error), I want to declare an integer variable
which will be given one value when the filter is applied
and another value when removed. The value of this integer
would then determine whether to execute the ShowAllData
code. My questions are: a) How and where do I declare this
integer so that it is available in all procedures
applicable to the userform & b) what other (easier?) way
could this check be accomplished.
Any help much appreciated.
 
J

Jonathan West

chris brunt said:
I have a project with a couple of userforms and other
modules. One of the userforms applies a filter to a data
list in Excel. Under certain criteria I wish to remove the
filter (ActiveSheet.ShowAllData) and to avoid this code
being executed when the fiter has not been applied (which
produces an error), I want to declare an integer variable
which will be given one value when the filter is applied
and another value when removed. The value of this integer
would then determine whether to execute the ShowAllData
code. My questions are: a) How and where do I declare this
integer so that it is available in all procedures
applicable to the userform

Above the first routine, include a line something like this

Private myInteger as Integer

myInteger will then be available to all routines within the userForm, but
not to any other module.
& b) what other (easier?) way
could this check be accomplished.
Any help much appreciated.

You would be better off asking that part of the question in
microsoft.public.excel.programming. This group deals with VBA in Word.

--
Regards
Jonathan West - Word MVP
MultiLinker - Automated generation of hyperlinks in Word
Conversion to PDF & HTML
http://www.multilinker.com
 

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

Top