+ Reply to Thread
Results 1 to 4 of 4

Help with selecting first day of month

  1. #1
    Registered User
    Join Date
    04-29-2004
    Posts
    92

    Help with selecting first day of month

    I have a form set up with a listbox which is filled with dates, from the first of the year to the last of the year. I have a command button that on click sends the selected date from the listbox to sheet1 cell b1. What I would like to do is onclick send the selected date to b1 like it already does, but ALSO put the first of the selected month into cell a1.


    Example's:

    I select 03/03/05. on click it sends it to cell b1 as 03/03/05 and in cell a1 it writes 03/01/05. Or if i pick any other day in march it puts march first in cell a1.
    The same goes for all months. If i pick a day in december i need december first to go into cell a1.

    Any help would be great.
    Thanks
    Chris

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello Chris,

    Y = Year(Range("B1"))
    M = Month(Range("B1"))
    D = 1

    Range("A1").Value = Format(M &"/" & D &"/" & Y, "mm/dd/yy")


    Hope this answers your question,
    Leith Ross

  3. #3
    Registered User
    Join Date
    04-29-2004
    Posts
    92
    Well, That does break it down a bit. I'll play with it and see what kind of if statements I can come up with.

    I was hoping there was an if statement i could use with cell b1. If cell b1's month is x then cell a1 = x/1/05. Like i said though, I'll play with it and see what i can do using that breakdown.
    Thanks
    Chris

  4. #4
    Registered User
    Join Date
    04-29-2004
    Posts
    92
    OH! Nice... Thank you! I see how it works now, sorry i replied before i played with it... That solves another problem i was going to run into with the year.



    Thanks

+ 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