How to put VBA formula in Excel Sheet

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi there,
how can i fix the error for this VBA?
Sub PutDate()
Range("A1") = "="Date :" & TEXT(TODAY(),"dd-mm-yy")"
End Sub
pls. help me for this. thanks in advance.
EricBB
 
One way:

Public Sub PutDate()
Range("A1").Formula = "=""Date :"" & TEXT(TODAY(),""dd-mm-yy"")"
End Sub

Note that quotes within the formula string must be doubled.
 
Back
Top