+ Reply to Thread
Results 1 to 3 of 3

VBA - number of monthdays ...

  1. #1
    Mirja
    Guest

    VBA - number of monthdays ...

    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

  2. #2
    Niek Otten
    Guest

    Re: VBA - number of monthdays ...

    Hi Mirja,

    Just leave out the "+1"

    --

    Kind Regards,

    Niek Otten

    Microsoft MVP - Excel

    "Mirja" <[email protected]> wrote in message
    news:[email protected]...
    > 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




  3. #3
    Harald Staff
    Guest

    Re: VBA - number of monthdays ...

    Hi Mirja

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

    You are not multiplying a date by 24 ?

    HTH. Best wishes Harald


    "Mirja" <[email protected]> skrev i melding
    news:[email protected]...
    > 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




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1