LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 105
Default Skip over a particular error

I'm using a macro to manipulate a series of pivot tables.

The macro uses a cell reference to decide which project to look for within
the pivot tables, but it is possible that the project does not exist within
all of them. So I want to get the macro to skip to the end of that section's
code if the pivot table in question doesn't contain the project. At the
moment I get an error code:

Runtime error '1004'
Unable to set the_Default property of the PivotItem class

I have looked into it myself and I think I might need to use error handling,
but when I tried to put the code in VBA fell over.

Could you point out what I should be putting in where?

There are 6 other sections like this one, each of them relating to a
different worksheet and pivot table.

mySourceData = Workbooks(HomeWS).Sheets("Imported Data").Range("F7").Value

Sheets("Department").Select
Range("B6").Select

ActiveSheet.PivotTables("PivotTable2").PivotFields ("Project").CurrentPage =
mySourceData

myRows = Selection.CurrentRegion.Rows.Count

Range("B6:D" & myRows + 3).Select
Selection.ShowDetail = False

myRows2 = Selection.CurrentRegion.Rows.Count

Range("B6:D" & myRows2 + 2).Select
Selection.Copy

Windows(HomeWS).Activate
Worksheets("Imported Data").Activate
Range("A13").Select
ActiveSheet.Paste
Application.CutCopyMode = False

SourceWS.Worksheets("Department").Activate
Selection.ShowDetail = True

ActiveSheet.PivotTables("PivotTable2").PivotFields ("Project").CurrentPage =
"(All)"

Many thanks for your help


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Skip if false? DeFautT Excel Worksheet Functions 2 October 28th 08 02:00 PM
using IF to skip Julie Excel Worksheet Functions 4 March 14th 08 10:21 PM
Question on "On Error GoTo skip" dan Excel Discussion (Misc queries) 2 July 1st 07 10:48 PM
On Error GoTo skip needs help dan Excel Discussion (Misc queries) 2 April 24th 06 06:29 PM
Skip blank cells; Run-time error 380 jbpyron Excel Programming 0 April 14th 06 08:56 PM


All times are GMT +1. The time now is 10:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"