Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 114
Default Need a Error Handling for this Macro

Please help.

I have this Macro. But the problem starts when there is no data in the pivot
table or no data in the data source. It will prompt a run time error 1004.

Private Sub Worksheet_Activate()
Me.PivotTables(1).PivotCache.Refresh
Range("C1").Activate
End Sub

I believe there is a way to exit this sub if running this sub causes an error.

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Need a Error Handling for this Macro

Private Sub Worksheet_Activate()
On Error Resume Next
Me.PivotTables(1).PivotCache.Refresh
Range("C1").Activate
End Sub

--
If this post helps click Yes
---------------
Jacob Skaria


" wrote:

Please help.

I have this Macro. But the problem starts when there is no data in the pivot
table or no data in the data source. It will prompt a run time error 1004.

Private Sub Worksheet_Activate()
Me.PivotTables(1).PivotCache.Refresh
Range("C1").Activate
End Sub

I believe there is a way to exit this sub if running this sub causes an error.

Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 114
Default Need a Error Handling for this Macro

Thanks... it works.

"Jacob Skaria" wrote:

Private Sub Worksheet_Activate()
On Error Resume Next
Me.PivotTables(1).PivotCache.Refresh
Range("C1").Activate
End Sub

--
If this post helps click Yes
---------------
Jacob Skaria


" wrote:

Please help.

I have this Macro. But the problem starts when there is no data in the pivot
table or no data in the data source. It will prompt a run time error 1004.

Private Sub Worksheet_Activate()
Me.PivotTables(1).PivotCache.Refresh
Range("C1").Activate
End Sub

I believe there is a way to exit this sub if running this sub causes an error.

Thanks.

Reply
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
Error Handling Kevin Excel Discussion (Misc queries) 4 June 19th 08 12:31 AM
Error Handling for xlCellTypeFormulas ccfcrup Excel Worksheet Functions 1 January 23rd 08 09:20 PM
Just create it regardless with error handling Bob Phillips Excel Discussion (Misc queries) 3 September 27th 07 06:23 PM
Handling #NUM! error Michel Khennafi Excel Worksheet Functions 1 February 26th 07 08:49 PM
Error handling in macro michaelberrier Excel Discussion (Misc queries) 7 May 23rd 06 09:33 PM


All times are GMT +1. The time now is 11:42 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"