PC Review


Reply
Thread Tools Rate Thread

Custom Filter in a Macro

 
 
Mike The Newb
Guest
Posts: n/a
 
      19th Nov 2008
I would like the Macro to prompt the user for what they want to see within
the filter; the user input will vary. What's the "prompt user" code?

Another question - I want to print the results which could vary in number of
rows - can a Macro accommodate that? How so?

Thank you in advance for your time and consideration.

Regards,
Mike

 
Reply With Quote
 
 
 
 
Sheeloo
Guest
Posts: n/a
 
      19th Nov 2008
1. Search Help for INPUTBOX

Following is the example from Help
Dim Message, Title, Default, MyValue
Message = "Enter a value between 1 and 3" ' Set prompt.
Title = "InputBox Demo" ' Set title.
Default = "1" ' Set default.
' Display message, title, and default value.
MyValue = InputBox(Message, Title, Default)

' Use Helpfile and context. The Help button is added automatically.
MyValue = InputBox(Message, Title, , , , "DEMO.HLP", 10)

' Display dialog box at position 100, 100.
MyValue = InputBox(Message, Title, Default, 100, 100)

2. You can set the print area through code like the example below (again
from Help);
ActiveSheet.PageSetup.PrintArea = _
ActiveCell.CurrentRegion.Address

"Mike The Newb" wrote:

> I would like the Macro to prompt the user for what they want to see within
> the filter; the user input will vary. What's the "prompt user" code?
>
> Another question - I want to print the results which could vary in number of
> rows - can a Macro accommodate that? How so?
>
> Thank you in advance for your time and consideration.
>
> Regards,
> Mike
>

 
Reply With Quote
 
Mike The Newb
Guest
Posts: n/a
 
      19th Nov 2008
I'm sorry, I do not understand this - I'm a Newb.

I record Macros manually, I do not write VB Script. My simple Macro looks
like this:
Selection.AutoFilter Field:=1, Criteria1:="=7777", Operator:=xlAnd
End Sub

I need the criteria1 to be variable (as apposed to always 7777) as input by
the user when prompted after kicking off the macro.

Regards,
Mike

"Sheeloo" wrote:

> 1. Search Help for INPUTBOX
>
> Following is the example from Help
> Dim Message, Title, Default, MyValue
> Message = "Enter a value between 1 and 3" ' Set prompt.
> Title = "InputBox Demo" ' Set title.
> Default = "1" ' Set default.
> ' Display message, title, and default value.
> MyValue = InputBox(Message, Title, Default)
>
> ' Use Helpfile and context. The Help button is added automatically.
> MyValue = InputBox(Message, Title, , , , "DEMO.HLP", 10)
>
> ' Display dialog box at position 100, 100.
> MyValue = InputBox(Message, Title, Default, 100, 100)
>
> 2. You can set the print area through code like the example below (again
> from Help);
> ActiveSheet.PageSetup.PrintArea = _
> ActiveCell.CurrentRegion.Address
>
> "Mike The Newb" wrote:
>
> > I would like the Macro to prompt the user for what they want to see within
> > the filter; the user input will vary. What's the "prompt user" code?
> >
> > Another question - I want to print the results which could vary in number of
> > rows - can a Macro accommodate that? How so?
> >
> > Thank you in advance for your time and consideration.
> >
> > Regards,
> > Mike
> >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro/ custom filter, criteria="abc" or blank CousinExcel Microsoft Excel Misc 1 17th Feb 2010 12:04 PM
Macro help - selecting rows after custom filter Joe Microsoft Excel Discussion 7 9th Dec 2008 05:12 PM
Use the custom filter dialog in a macro KenInPortland Microsoft Excel Worksheet Functions 3 16th Aug 2008 03:11 AM
Macro to copy and paste into a custom filter =?Utf-8?B?SnRtdHVybmVy?= Microsoft Excel Misc 6 1st Feb 2007 07:14 PM
macro custom filter stefanolsson Microsoft Excel Worksheet Functions 0 28th Nov 2006 10:34 AM


Features
 

Advertising
 

Newsgroups
 


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