Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Excel 2007 Run-Time error

Hi

You have to unprotect the sheet before you can refresh the Pivot table.

sub Refresh()

Activesheet.unprotect Password:="JustMe"

'Your code to Refresh to Pivot table

ActiveSheet.Protect Password:="JustMe"
End sub

Hopes this help

---
Per


"Marilyn" skrev i meddelelsen
...
I have a user in my group that created a macro that updates the data based
on
the pivot table. The Pivot table is hidden and the macro runs fine when
the
worksheet is not protected but once he protects the worksheets and tries
to
run the Update macro he gets the "Run-time error 1004;

The code for the macros looks like:
' Update_Form Macro
'

'
Range("V30").Select
ActiveSheet.PivotTables("PivotTable4").PivotCache. Refresh
Range("V46").Select
ActiveSheet.PivotTables("PivotTable2").PivotCache. Refresh

End Sub

Any thoughts why protecting the sheet gives out that error?


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
run time error 1004 general odbc error excel 2003 vba Mentos Excel Programming 5 January 24th 11 02:56 PM
Excel 2007 calculate time between 2 date/time columns Kevo Excel Discussion (Misc queries) 8 April 25th 09 12:02 AM
Run-time error 1004 since upgrading from Excel 2003 to 2007. PJ Excel Programming 1 July 23rd 08 11:55 PM
Excel 2007 VBA - Run-time error 1004 SG Excel Programming 10 January 28th 08 03:48 PM
Excel 2007 Beta 2 - Macro Run-time error '424' Object required jcm21 Excel Programming 0 June 16th 06 07:17 PM


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

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

About Us

"It's about Microsoft Excel"