Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

filter in a macro using a textbox value

  Asked By: Reginheraht    Date: Nov 12    Category: MS Office    Views: 1455
  

I'am writing a macro in which i want to filter on a specific value
given by the user of the macro. This value has to be entered into a
text box at the beginning of the macro. after some other steps in the
macr i want to filter on the value given in the textbox. I don't know
how to make VBA recognize the textbox value as criteria for the
filter. Now i have the value set as week1 = First_week.TextBox1.Text
but when i enter this as criteria in the filter macro it filters on
the value week1 instead of the number represented by the variable
week1 (ie the week1 value is 50, it now still filters on th text week
1 instead the value 50). does anyone know a good code for this??

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Jakson Williams     Answered On: Nov 12

I haven't actually tried this, but maybe something along these lines
will work...

1. In Declarations, dim a variable such as UserVAL as Public
2. Modify your macro  -- base it on UserVAL.
3. When your macro is launched (by command button, the change event of
the textbox, or whatever) set  the value of UserVAL to the contents of
the textbox.
4. Then run the macro.

 
Didn't find what you were looking for? Find more on filter in a macro using a textbox value Or get search suggestion and latest updates.




Tagged: