Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,388
Default Warning Message (at open) if Multiple Sheets are Selected

Is there a macro/code that will warn me when multiple sheets are selected
when I open a file? A lot of my files have 10+ tabs with long names so I
don't necessarily see all of the active tabs. So if I happened to save the
file with multiple tabs selected and then reopen it and start working
(without checking), I overwrite information I didn't intend to overwrite. I
have seen the msgbox activewindow.selectedsheets.count code but I don't know
where to put it in VB.

Any help is appreciated.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,358
Default Warning Message (at open) if Multiple Sheets are Selected

you could just have vba code that when you open the workbook always goes to a
specific tab, then you wouldn't have to worry about whether or not multiple
tabs were selected.
--
John C


"Dave" wrote:

Is there a macro/code that will warn me when multiple sheets are selected
when I open a file? A lot of my files have 10+ tabs with long names so I
don't necessarily see all of the active tabs. So if I happened to save the
file with multiple tabs selected and then reopen it and start working
(without checking), I overwrite information I didn't intend to overwrite. I
have seen the msgbox activewindow.selectedsheets.count code but I don't know
where to put it in VB.

Any help is appreciated.

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Warning Message (at open) if Multiple Sheets are Selected

You could add this procedure to every workbook's project that you need (in a
general module):

Option Explicit
Sub Auto_Open()
if activewindow.selectedsheets.count 1 then
msgbox "Be careful--multiple sheets selected"
end if
End Sub

If you're new to macros:

Debra Dalgleish has some notes how to implement macros he
http://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm

(General, Regular and Standard modules all describe the same thing.)

Dave wrote:

Is there a macro/code that will warn me when multiple sheets are selected
when I open a file? A lot of my files have 10+ tabs with long names so I
don't necessarily see all of the active tabs. So if I happened to save the
file with multiple tabs selected and then reopen it and start working
(without checking), I overwrite information I didn't intend to overwrite. I
have seen the msgbox activewindow.selectedsheets.count code but I don't know
where to put it in VB.

Any help is appreciated.

Thanks


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,388
Default Warning Message (at open) if Multiple Sheets are Selected

Thank you for the information. I don't know VB beyond what I get from this
forum. What is the code I would input and where would I input it in the VB
editor to specify the file open to a specific sheet?

Thanks

"John C" wrote:

you could just have vba code that when you open the workbook always goes to a
specific tab, then you wouldn't have to worry about whether or not multiple
tabs were selected.
--
John C


"Dave" wrote:

Is there a macro/code that will warn me when multiple sheets are selected
when I open a file? A lot of my files have 10+ tabs with long names so I
don't necessarily see all of the active tabs. So if I happened to save the
file with multiple tabs selected and then reopen it and start working
(without checking), I overwrite information I didn't intend to overwrite. I
have seen the msgbox activewindow.selectedsheets.count code but I don't know
where to put it in VB.

Any help is appreciated.

Thanks

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Warning Message (at open) if Multiple Sheets are Selected

With your workbook open, right-click on the Excel Icon left of "File" on
worksheet menubar.

Select "View Code" and paste this into the module that opens.

Private Sub Workbook_Open()
If ActiveWindow.SelectedSheets.Count 1 Then
Sheets("Sheet1").Select
'otherwise it will open to last active sheet when saved
End If
End Sub


Gord Dibben MS Excel MVP

On Tue, 14 Oct 2008 12:18:07 -0700, Dave
wrote:

Thank you for the information. I don't know VB beyond what I get from this
forum. What is the code I would input and where would I input it in the VB
editor to specify the file open to a specific sheet?

Thanks

"John C" wrote:

you could just have vba code that when you open the workbook always goes to a
specific tab, then you wouldn't have to worry about whether or not multiple
tabs were selected.
--
John C


"Dave" wrote:

Is there a macro/code that will warn me when multiple sheets are selected
when I open a file? A lot of my files have 10+ tabs with long names so I
don't necessarily see all of the active tabs. So if I happened to save the
file with multiple tabs selected and then reopen it and start working
(without checking), I overwrite information I didn't intend to overwrite. I
have seen the msgbox activewindow.selectedsheets.count code but I don't know
where to put it in VB.

Any help is appreciated.

Thanks


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
Pasting with multiple sheets selected loses undo history- why? Ruthhd Excel Discussion (Misc queries) 0 July 1st 08 11:09 AM
Opening multiple Excel files that contain varied selected sheets MLBrownewell Excel Worksheet Functions 0 September 14th 05 05:48 PM
How do I undo an action when multiple sheets are selected? Jared Excel Worksheet Functions 0 August 15th 05 10:16 PM
message "Warning: Open source to update values..." rbyteme Links and Linking in Excel 1 March 8th 05 12:00 AM
Multiple sheets selected twa14 Excel Discussion (Misc queries) 2 December 21st 04 11:15 AM


All times are GMT +1. The time now is 10:58 AM.

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"