autofilter

L

Louise

When I run autofilter using a macro and then print preview (or print) the titles are gone. I've checked print ranges and I have them correct. Any suggestions?
 
F

Frank Kabel

Hi
you may post your current macro for analysing it :)

--
Regards
Frank Kabel
Frankfurt, Germany

Louise said:
When I run autofilter using a macro and then print preview (or
print) the titles are gone. I've checked print ranges and I have them
correct. Any suggestions?
 
L

Louise

Here it is. I appreciate you looking it over. The Cell A21 is where the data that needs to be filter begins

----------------------------------------

ApplicationScreenUpdating = Fals
Sheets("Data").Selec
Range("A21").Select
Title1= "START
Title2 = "END
Prompt1 = "Please enter Starting Date
Prompt2 = "Please enter Ending Date"
UserVal = Application.InputBox(Prompt1
If UserVal = False The
Exit Su
Els

UserVal2 = Application.InputBox(Prompt2
If UserVal2 = False The
Exit Su
Els
Selection.AutoFilter Field:=1, Criteria1:=">=" & UserVal, Operator:=xlAnd
, Criteria2:="<=" & UserVal
End I
End I

ActiveWindow.SelectedSheets.PrintPrevie
Selection.AutoFilte
Sheets("Main Page").Selec
Range("A1").Selec
ApplicationScreenUpdating = Tru
End Sub
 
L

Louise

Revised. I forgot to incl. Title1 & Title
------------------------------------------------------------------------
ApplicationScreenUpdating = Fals
Sheets("Data").Selec
Range("A21").Select
Title1= "START
Title2 = "END
Prompt1 = "Please enter Starting Date
Prompt2 = "Please enter Ending Date"
UserVal = Application.InputBox(Prompt1,Title1
If UserVal = False The
Exit Su
Els

UserVal2 = Application.InputBox(Prompt2,Title2
If UserVal2 = False The
Exit Su
Els
Selection.AutoFilter Field:=1, Criteria1:=">=" & UserVal, Operator:=xlAnd
, Criteria2:="<=" & UserVal
End I
End I

ActiveWindow.SelectedSheets.PrintPrevie
Selection.AutoFilte
Sheets("Main Page").Selec
Range("A1").Selec
ApplicationScreenUpdating = Tru
End Sub
 

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