AutoFilter / Macro

L

Lisa

I am trying to print information within a certain range of dates only. Using the Auto Filter and recording a macro, what do i have to write to let the macro know to stop at the range window, let me input the range and keep on running the macro
I appreciate any help you can give me
Thanks
Lisa
 
E

Earl Kiosterud

Lisa,

What do you mean by "range window." The Autofilter has dropdowns with which
the user selects the desired records. Is that what you mean?

--
Earl Kiosterud
mvpearl omitthisword at verizon period net
-------------------------------------------

Lisa said:
I am trying to print information within a certain range of dates only.
Using the Auto Filter and recording a macro, what do i have to write to let
the macro know to stop at the range window, let me input the range and keep
on running the macro?
 
P

Peo Sjoblom

Why not use an input box where you type in the stop date, attach it to a
button from the forms toolbar.
I am assuming that the dates are in the first column with autofilter

Sub Date_Range()
Application.ScreenUpdating = False
UserVal = Application.InputBox("Enter Stop Date")
If UserVal = False Then
Exit Sub
Else
Selection.AutoFilter Field:=1, Criteria1:="<=" & UserVal,
Operator:=xlAnd
End If
Application.ScreenUpdating = True
End Sub

attach the macro to a button, click the button and type in the last date you
want to be included.


--

Regards,

Peo Sjoblom

Lisa said:
I am trying to print information within a certain range of dates only.
Using the Auto Filter and recording a macro, what do i have to write to let
the macro know to stop at the range window, let me input the range and keep
on running the macro?
 

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