+ Reply to Thread
Results 1 to 7 of 7

Macro - Calendar

  1. #1
    Registered User
    Join Date
    02-19-2004
    Posts
    11

    Thumbs up Macro - Calendar

    Hi Guys,

    I am using excel 2007 and trying to find a fancy way to enter a date in a cell, such as clicking the cell and a Calendar appear were you can pick the required date (Year, Month, Day) (instead of a drop down menu which could be very long and annoying if trying to cover 3 years) .

    your help and thoughts on this one is appreciated.

    Thanks.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Using the Forum Search engine for Calendar should bring many examples

    See

    http://www.excelforum.com/developmen...ml#post2009257

    Or the DatePicker addin here

    http://www.excel-it.com/free_addins.htm
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    02-19-2004
    Posts
    11
    Thanks for your reply Roy, I did check the search engine and the links you sent me, unfortunately I am not sure where to copy and the code to or if I have to create a sheet with a specific name to get it to work… etc.
    Code I tried using:

    Private Sub UserForm_Initialize()

    Dim i As Long
    Dim lYearsAdd As Long
    Dim lYearStart As Long

    lYearStart = Year(Date) - 10
    lYearsAdd = Year(Date) + 10
    With Me
    .Width = frmWidth
    .Height = frmHeight2
    For i = 1 To 12
    .CB_Mth.AddItem Format(DateSerial(Year(Date), i, 1), "mmmm")
    Next

    For i = lYearStart To lYearsAdd
    .CB_Yr.AddItem Format(DateSerial(i, 1, 1), "yyyy")
    Next

    .Tag = "Calendar"
    .CB_Mth.ListIndex = Month(Date) - 1
    .CB_Yr.ListIndex = Year(Date) - lYearStart
    .Tag = ""
    End With
    Call Build_Calendar

    End Sub
    Also i tried the Addin and it is very close to what i want! the only problem is that the workbook is going to be sent to different users for updates which mean each user mush install the addon sepratly... were as macro will be built in the workbook.

    Hope i am making any sense
    Last edited by Tarek; 12-10-2008 at 07:06 AM.

  4. #4
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326
    Your post does not comply with Rule 3 of our Forum Rules. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here http://www.excelforum.com/misc.php?do=bbcode#code

  5. #5
    Registered User
    Join Date
    02-19-2004
    Posts
    11
    Quote Originally Posted by arthurbr View Post
    Your post does not comply with Rule 3 of our Forum Rules. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here http://www.excelforum.com/misc.php?do=bbcode#code
    I simply copied and pasted a code Roy reffered me to! didn't mean to violate any rules oh Mighty one!

  6. #6
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326
    Please wrap code as asked, it will make life easier for everybody if they want to coupy paste- Thx

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Quote Originally Posted by Tarek View Post
    I simply copied and pasted a code Roy reffered me to! didn't mean to violate any rules oh Mighty one!
    Do not be sarcastic, if you want free help then read the rules & follow them. You were asked politely to do so.

    If you think the rules are not necessary then feel free to post elsewhere

+ 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