View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.misc
Cimjet[_3_] Cimjet[_3_] is offline
external usenet poster
 
Posts: 157
Default If cell is blank automatically enter today's date in the same cell

Hi Garry
I think you meant to say To access the VB editor press Alt+F11 not Ctrl+F11
Best regards
Cimjet
"GS" wrote in message ...
LCTECH001 laid this down on his screen :
On Jan 12, 12:29 pm, GS wrote:
Scrap all the previous code posted, and delete it ALL from your
workbook!

In the VBE, double-click ThisWorkbook and paste the following into the
code window:

Option Explicit

Private Sub Workbook_Open()
With Sheets("<sheetname").Range("M10")
If.Value = "" Then .Value =Date
End With
End Sub

**Be sure to substitute <sheetname with the actual sheet name!

--
Garry

Free usenet access athttp://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


Hi Garry,

Thank you for assisting with this! I have etered this new code into
the VBE Code sheet but nothing is happening! When I copy and paste the
code in I have pressed the save icon but I'm not sure if I have to
save the code as a macro? Do I name it to run it in the actual
worksheet as I have deleted the formula I had in M10 and now the cell
is blank and todays date is not appearing! Can you advise what I'm
doing wrong?

Best Regards

LC


The code goes in the code window behind ThisWorkbook. It will run every
time the workbook is opened.

To access the VBE keyboard Ctrl+F11 and then expand the 'Microsoft
Excel Objects' folder. Double-click on 'ThisWorkbook' and paste the
code.

***Make sure you edit <sheetname to match the name of the sheet you
want this to affect***

**Remove this code if you put it anywhere other than in ThisWorkbook**

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc