A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Need a Error Handling for this Macro



 
 
Thread Tools Display Modes
  #1  
Old June 4th, 2009, 07:32 AM posted to microsoft.public.excel.misc
[email protected]
external usenet poster
 
Posts: 109
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  
Old June 4th, 2009, 07:51 AM posted to microsoft.public.excel.misc
Jacob Skaria
external usenet poster
 
Posts: 5,952
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  
Old June 4th, 2009, 07:58 AM posted to microsoft.public.excel.misc
[email protected]
external usenet poster
 
Posts: 109
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.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:03 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.