Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Run-time error '1004' - Unable to set the Visible property of the Worksheet class

Excel 97

All of a sudden I am getting the above error on an existing workbook
when activating and deactivating worksheets using VBA e.g.

Private Sub CommandButton3_Click()
Worksheets("WABC").Visible = True
Worksheets("WABC").Select
End Sub

The above procedure has worked previously and I cannot understand why
this is happening.

Any help would be appreciated.

Thanks
Shal
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Run-time error '1004' - Unable to set the Visible property of theWorksheet class

Try changing the .takefocusonclick property to False for your commandbutton.

or add
activecell.activate
near the top of your code

This is a bug in xl97 that was fixed in xl2k.



Shalin Chopra wrote:

Excel 97

All of a sudden I am getting the above error on an existing workbook
when activating and deactivating worksheets using VBA e.g.

Private Sub CommandButton3_Click()
Worksheets("WABC").Visible = True
Worksheets("WABC").Select
End Sub

The above procedure has worked previously and I cannot understand why
this is happening.

Any help would be appreciated.

Thanks
Shal


--

Dave Peterson

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 208
Default Run-time error '1004' - Unable to set the Visible property of the Worksheet class

Hi
Is the workbook (rather than the worksheet) protected? You can't
change the structure of the workbook (like making a sheet visible) if
it is.

regards
Paul
(Shalin Chopra) wrote in message . com...
Excel 97

All of a sudden I am getting the above error on an existing workbook
when activating and deactivating worksheets using VBA e.g.

Private Sub CommandButton3_Click()
Worksheets("WABC").Visible = True
Worksheets("WABC").Select
End Sub

The above procedure has worked previously and I cannot understand why
this is happening.

Any help would be appreciated.

Thanks
Shal

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Run-time error '1004' - Unable to set the Visible property of the Worksheet class

Thank you all for your help. The workbook had inadvertently been
protected and this was the cause of this error. Works perfectly now.

Cheers
Shal
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 1004: Unable to get the axis property Ana via OfficeKB.com Charts and Charting in Excel 1 June 24th 09 11:47 AM
VBA error: Unable to set the Values property of the Series class Marco Shaw Charts and Charting in Excel 1 July 12th 05 02:34 PM
Error 1004 - unable to set the orientation of the page setup class E Sullivan Excel Programming 4 October 27th 03 02:31 PM
Unable to set the colorIndex Property of the Interior Class Error GriffyGriff Excel Programming 3 October 3rd 03 04:37 PM
HELP!! Excel 2000 Copy of worksheet class failed run time Error 1004 Martin[_6_] Excel Programming 1 August 2nd 03 03:16 PM


All times are GMT +1. The time now is 04:27 AM.

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"