Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default What am I missing here...?


why doesn't this code work on a command button, but works as sub?

---------------------------------- Fails at Range("A1").Select

Private Sub CommandButton2_Click()

' Application.ScreenUpdating = False
' SHOWS ONLY SHEETS "A"
For Each sh In Sheets
sh.Visible = True
Next sh
Sheets(Array("A 01", "A 02", "B 01", "B 02")).Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("A 01").Visible = True
Sheets("A 02").Visible = True
Sheets("A 01").Select
Range("A1").Select
' Application.ScreenUpdating = True

End Sub

---------------------------------------------
Yet this works via MacroRun

Sub Macro1()

For Each sh In Sheets
sh.Visible = True
Next sh
Sheets(Array("A 01", "A 02", "B 01", "B 02")).Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("A 01").Visible = True
Sheets("A 02").Visible = True
Sheets("A 01").Select
Range("A1").Select

End Sub

----------------------------------------------

This selects cell A1 on Sheet "A 01"

Does this have something to do with the command button still be
selected? How to get around this?

Thanks for your input.

Bruce


--
swatsp0p


------------------------------------------------------------------------
swatsp0p's Profile: http://www.excelforum.com/member.php...o&userid=15101
View this thread: http://www.excelforum.com/showthread...hreadid=345564

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
i'm missing something [email protected] Excel Worksheet Functions 11 February 17th 07 06:23 AM
Toolbars Missing, And option to Add Missing SmeetaG Excel Discussion (Misc queries) 3 October 19th 05 11:43 AM
What am I missing here....? swatsp0p[_2_] Excel Programming 3 February 16th 05 01:59 PM
Missing Row Debbie Humphrey Excel Worksheet Functions 3 January 12th 05 06:26 PM
Add-ins missing lrochman Excel Programming 1 October 2nd 03 10:06 PM


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