Custom Filter in a Macro

  • Thread starter Thread starter Mike The Newb
  • Start date Start date
M

Mike The Newb

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
 
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
 
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
 
Back
Top