How to put VBA formula in Excel Sheet

E

EricBB

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
 
J

JE McGimpsey

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top