Advanced Filter Macro Failing

M

Mustang

Hi,

I have recorded a macro that uses the advanced filter to give me all work
that was carried out between two dates.

This data is copied to a new sheet.

There is a third sheet which contains a pivot table to analyse this data.

This was working perfectly when I had test data in, now that we are
inputting real data with different dates to my test it is failing.

I am running the macro from a button.

If I go through the exact steps of the macro it works, so I re-record it and
it fails to work.

Any ideas why?

Thanks
 
J

JLatham

Someone is going to want some more information on this. It would be nice to
see the code generated by your recorded macro. Also, next time you try it
and it fails, it would be good if you hit the [Debug] button and let us know
what line is highlighted - that's the line that caused the failure. Finally,
the specific error message would be another helpful bit of information.
 
D

Dave Peterson

I don't have an idea.

But I'd step through the macro using the F8 key and between every major
(whatever that means), I'd swap back to excel to see if things look like they
should.
 
M

Mustang

Hi all,

Sorry about the slow response, had sick kids over the weekend!

Code is:
*******************************************************
Sub Pivot_Filter()
'
' Pivot_Filter Macro
' Macro recorded 4/05/2009 by Sally Evans. This macro filters the input
data ready for pivot table.
'

'This takes the new criteria range and applies it to the Pivot Table Source
Data

Sheets("Pivot Source").Visible = True
Sheets("Pivot Source").Select
Range("I15").Select
Range("Master_Job").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:= _
Sheets("Master Job").Range("A1:C2"), CopyToRange:=Range("A1:p1"),
Unique:=False

' This updates the Pivot Table with the new criteria

Sheets("Monthly Job Sheet").Select
Range("A3").Select
ActiveSheet.PivotTables("Monthly Figures").PivotCache.Refresh

'This hides the Pivot Source sheet

Sheets("Pivot Source").Visible = False

'Reminder to change job number so that the link in the gear master will work

MsgBox "Please select the job number then go to the Gear Master and
enter the filter dates required for this months report"
End Sub
***********************************************************

Occassionally it will not give an error but the advanced filter portion will
not yield any information therefore the Pivot Table does not update.

Please let me know if you require any further information or copies of
spreadsheets etc.
 

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