Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default How to tell if multiple sheets are selected?

How can I tell if multiple sheets have been selected?

Thanks in advance

Mike


  #2   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default How to tell if multiple sheets are selected?

if activewindow.SelectedSheets.Count 1

"Mike Weaver" wrote:

How can I tell if multiple sheets have been selected?

Thanks in advance

Mike



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to tell if multiple sheets are selected?


Hello Mike,

It is a good practice to preface Window operations with the application
to which they belong. Functions like ActiveWindow are envrironmentally
dependent. If you were troubleshooting your code in the VBA Editor,
ActiveWindow would assume you are referring to the active window in the
VBA Editor and not Excel. To prevent these problems qualify your object
methods like this...

Excel.ActiveWindow.SelectedSheets.Count

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=509245

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default How to tell if multiple sheets are selected?

I stepped through this code in the VBE in book2.xls with book1.xls active in
excel:

Option Explicit
Sub testme01()
Debug.Print ActiveWindow.Caption
End Sub

I saw this in the immediate window:
book1.xls



Leith Ross wrote:

Hello Mike,

It is a good practice to preface Window operations with the application
to which they belong. Functions like ActiveWindow are envrironmentally
dependent. If you were troubleshooting your code in the VBA Editor,
ActiveWindow would assume you are referring to the active window in the
VBA Editor and not Excel. To prevent these problems qualify your object
methods like this...

Excel.ActiveWindow.SelectedSheets.Count

Sincerely,
Leith Ross

--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=509245


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default How to tell if multiple sheets are selected?

Thanks. That gets me headed in the right direction.

Mike

"Leith Ross" wrote
in message ...

Hello Mike,

It is a good practice to preface Window operations with the application
to which they belong. Functions like ActiveWindow are envrironmentally
dependent. If you were troubleshooting your code in the VBA Editor,
ActiveWindow would assume you are referring to the active window in the
VBA Editor and not Excel. To prevent these problems qualify your object
methods like this...

Excel.ActiveWindow.SelectedSheets.Count

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile:
http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=509245



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
Scroll Lock for selected multiple sheets Keyrookie Excel Worksheet Functions 2 December 4th 09 03:52 PM
Warning Message (at open) if Multiple Sheets are Selected Dave Excel Discussion (Misc queries) 4 October 14th 08 11:37 PM
Pasting with multiple sheets selected loses undo history- why? Ruthhd Excel Discussion (Misc queries) 0 July 1st 08 11:09 AM
How do I undo an action when multiple sheets are selected? Jared Excel Worksheet Functions 0 August 15th 05 10:16 PM
Multiple sheets selected twa14 Excel Discussion (Misc queries) 2 December 21st 04 11:15 AM


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