LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 371
Default Select range fails

The code is in ThisWorkbook. There are problems when quitting Excel with
several wbooks open. If this is the only workbook open the code runs ok but
fails if there are others open as well. I thought by placing it in
ThisWorkbook module it was specific but maybe not. How should I qualify the
Select statement please?

Private Sub Workbook_BeforeClose(Cancel As Boolean)

Sheets.Add After:=Sheets(Sheets.Count)
Sheets(Sheets.Count).Range("A100").Select 'Fails here if other wbooks
are open

ActiveWindow.DisplayGridlines = False

Application.DisplayAlerts = False
ActiveWorkbook.Save
Application.DisplayAlerts = True

End Sub

T.I.A.

Geoff
 
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
Excel VBA Paste of Range with PrefixCharacter fails from VB.NET Nicholas Dreyer Excel Discussion (Misc queries) 0 April 6th 07 04:09 AM
select method of range class fails mark kubicki Excel Programming 12 April 27th 05 02:37 PM
Named Range Fails in VBA Code Dean Hinson[_3_] Excel Programming 3 January 24th 05 03:48 PM
Sheets select method fails when workbook is opened by another workbook Mike Excel Programming 2 June 8th 04 04:17 AM
Select method of Range fails J West Excel Programming 1 June 7th 04 02:41 PM


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