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

On Jan 18, 5:15*am, GS wrote:
correction...

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


* To access the VBE keyboard *Alt+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 codeifyou put it anywhere other than in ThisWorkbook**


--
Garry

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


Hi! Thank you so much for the explanation and taking the time to share
your knowledge...and it works! It was driving me mad! I wanted to add
another cell (M10 again but on another worksheet in the same workbook
into the code can you advise on how I do this. I tried this but it
gave me an error!

Option Explicit


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

Many thanks in advance

LC