LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default change cell on exit vba

Success will also be thwarted if in the shorter version the user presses 'NO'
to save changes.

Macro - Something:- that does what you tell it to do and not what you want
it to do. Anonymous.


"Tom Ogilvy" wrote:

Just to add,
Unless it is a single sheet workbook, the results might be more satisfying
if the range is qualified with a specific sheet name. Otherwise, the command
assumes the activesheet and success clearing a specific range on a specific
sheet in Thisworkbook (assuming that is the objective) might be thwarted by
the user.

--
Regards,
Tom Ogilvy


"Vasant Nanavati" wrote:

A little shorter:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Range("A1:B100").ClearContents 'alter range to suit
End Sub

__________________________________________________ ___________________


"Mike H" wrote in message
...
Try this in the before_close workbook event:-

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Set myRange = Worksheets("Sheet1").Range("A1:B100") '< Alter to suit
With myRange
.Select
.Clear
End With
ActiveWorkbook.Save
End Sub

"Joost" wrote:

Hello,

Is it possible to clear cells when a workbook is closed with vba
automatically.
I can't figur it out who can help me

Thanks






 
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
MultiPage exit/change event Patrick Simonds Excel Programming 2 August 29th 06 04:06 AM
How do I exit on blank cell? [email protected] Excel Programming 2 May 3rd 06 10:10 PM
How do I change cell color upon entry, and exit? Deb Excel Worksheet Functions 1 August 4th 05 09:48 AM
Run Macro on cell exit Kelly Excel Programming 7 May 5th 04 09:42 PM
If a called sub exit, how to the caller exit right away? luvgreen[_4_] Excel Programming 4 February 24th 04 05:06 PM


All times are GMT +1. The time now is 10:20 PM.

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"