VBA - number of monthdays ...

  • Thread starter Thread starter Mirja
  • Start date Start date
M

Mirja

Hello!

I would like to change the follwoing command:

dbentry = Day(DateSerial(Year(Date), Month(Date) + 1, 0))
* 24

Excel should take the number of days of the month "two
days ago" (e.g. today is March 2nd, Excel should take
number of days in February). My problem is that data from
the previous month needs to be calculated on 1st and 2nd
of the current month ...

Can anybody help?

Thank you,
Mirja
 
Hi Mirja,

Just leave out the "+1"

--

Kind Regards,

Niek Otten

Microsoft MVP - Excel
 
Hi Mirja

Day(DateSerial(Year(Date-2), Month(Date-2) + 1, 0))

You are not multiplying a date by 24 ?

HTH. Best wishes Harald
 

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

Back
Top