#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Clear cells

Hello,

I have a file that I would need certain cells to be cleared out when the
file is opened for the first time during the day!!!

What the file does is basically for my employees asking to leave earlier,
they add their name to the file, save it and close it. I want to have a
macro that will run everytime the file is opened and if you are the first
person opening it today (so basically if the last time it was saved was for
yesterday's date), I would like to have certain fields to be cleared...

If any one know of a way to do this, it would be great...

Thanks!!!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Clear cells

Just use something like

Range("A1,C1,E1").Value = ""

Change the cells to the ones you want to clear.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"One-Leg" wrote in message
...
Hello,

I have a file that I would need certain cells to be cleared out
when the
file is opened for the first time during the day!!!

What the file does is basically for my employees asking to
leave earlier,
they add their name to the file, save it and close it. I want
to have a
macro that will run everytime the file is opened and if you are
the first
person opening it today (so basically if the last time it was
saved was for
yesterday's date), I would like to have certain fields to be
cleared...

If any one know of a way to do this, it would be great...

Thanks!!!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Clear cells

That I know!!!

But what I don't know is how can it be done as soon as the file is opened
but only when the file is opened for the first time during the day!!!

"Chip Pearson" wrote:

Just use something like

Range("A1,C1,E1").Value = ""

Change the cells to the ones you want to clear.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"One-Leg" wrote in message
...
Hello,

I have a file that I would need certain cells to be cleared out
when the
file is opened for the first time during the day!!!

What the file does is basically for my employees asking to
leave earlier,
they add their name to the file, save it and close it. I want
to have a
macro that will run everytime the file is opened and if you are
the first
person opening it today (so basically if the last time it was
saved was for
yesterday's date), I would like to have certain fields to be
cleared...

If any one know of a way to do this, it would be great...

Thanks!!!




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Clear cells


Try this.. put this in ThisWorkbook.

I am assuming that your data is A1:A10 and that you can use B10 as a
"spot" for date. You can adjust accordingly.



Private Sub Workbook_Open()


If Range("B10").Value < Format(Now(), "MMM DD YY") Then

Range("A1:A10").Value = ""

End If

End Sub

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)

Range("B10").Value = Format(Now(), "MMM DD YY")

End Sub


--
Bearacade
------------------------------------------------------------------------
Bearacade's Profile: http://www.excelforum.com/member.php...o&userid=35016
View this thread: http://www.excelforum.com/showthread...hreadid=547990

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
Cells.Clear Ben Dummar Excel Discussion (Misc queries) 3 January 24th 07 10:50 PM
clear contents cells of unprotected cells Ed Excel Programming 6 January 12th 06 06:09 PM
Clear Cells Mike Excel Discussion (Misc queries) 4 November 20th 05 11:50 PM
Clear cells with #N/A mthomas[_6_] Excel Programming 4 August 12th 05 04:24 PM
Clear cells range if certain cells are all empty gschimek - ExcelForums.com Excel Programming 6 May 13th 05 10:38 PM


All times are GMT +1. The time now is 12:28 AM.

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"