Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Cells.Clear | Excel Discussion (Misc queries) | |||
clear contents cells of unprotected cells | Excel Programming | |||
Clear Cells | Excel Discussion (Misc queries) | |||
Clear cells with #N/A | Excel Programming | |||
Clear cells range if certain cells are all empty | Excel Programming |