View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
darrenmcconachie darrenmcconachie is offline
external usenet poster
 
Posts: 6
Default If Cell Contents =today() then....

Course it is. Silly me!!

Typo, VBA is Date not Today


On Oct 25, 12:25 pm, "Bob Phillips" wrote:


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"darrenmcconachie" wrote in ooglegroups.com...



Try
ActiveCell.Formula = "=today()"


or
ActiveCell.Value = Today


Cheers
Darren


On Oct 25, 10:44 am, nospaminlich
wrote:
I'm trying to write a macro where if the date in cell A1 is the same as
today's date then the macro ends but if the cell is blank or has any

other
date then it puts today's date in cell F2


The code is below but it isn't recognising where the date in A1 is the

same
as today's - it continues to put today's date in F2.


I'm not sure what I've done wrong but I've tried a number of variations

on a
theme without success so I'm stuck and would really appreciate some

help.

Thanks a lot


-------------


Sub hats()
Range("a1").Select
If ActiveCell.Value = "=today()" Then
End
ElseIf ActiveCell.Value < "=today()" Then
Range("F2").Select
ActiveCell.FormulaR1C1 = "=today()"
Selection.Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,

SkipBlanks:= _
False, Transpose:=False
ActiveSheet.Paste
Application.CutCopyMode = False
End If


End Sub- Hide quoted text -- Show quoted text -