formula in code

  • Thread starter Thread starter geebee
  • Start date Start date
G

geebee

hi,

i have the following:

Dim CurrentReportMonth As Date
CurrentReportMonth = "=DATE(YEAR(NOW()),MONTH(NOW())-1+0,1)"

i am trying to figure out how i can make this work, like setting the
currentreportmonth in code, but i keep getting the error message. what am i
doing wrong?

thanks in advance,
geebee
 
Dim CurrentReportMonth As Date
CurrentReportMonth = DateSerial(Year(Date),Month(Date)-1,1)


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
Sub gibbs()
Dim CurrentReportMonth As Date
CurrentReportMonth = Evaluate("DATE(YEAR(NOW()),MONTH(NOW())-1+0,1)")
MsgBox (CurrentReportMonth)
End Sub
 

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

Similar Threads

previous year 2
paste formula 2
type mismatch 3
show value of formula 3
Excel Conditional formula for different scenarios 0
last record 4
Adapt macro 1
format number 2

Back
Top