Results 1 to 5 of 5
  1. #1
    4 Star Lounger
    Join Date
    May 2004
    Location
    Toronto, Ontario, Canada
    Posts
    425
    Thanks
    5
    Thanked 0 Times in 0 Posts

    format date (Excel 2000)

    Hi all, I am tring to figure out how to format the date that is inputted using an access calendar control, what i have here works, but I would like to know how to change the format to be format(date,"ddmmyy").
    Thank you all,
    Darryl.

    Private Sub CommandButton1_Click()
    Dim x As Range
    Set x = Application.Worksheets(1).Cells(1, 1)
    x = Me.Calendar1.Value
    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: format date (Excel 2000)

    Since the cell is fixed, you don't need to set the format in code, you can do it interactively:
    - Select the cell.
    - Select Format | Cells...
    - In the Number tab, select the Custom category.
    - Enter ddmmyy in the Type box.
    - Click OK.

  3. #3
    4 Star Lounger
    Join Date
    May 2004
    Location
    Toronto, Ontario, Canada
    Posts
    425
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Re: format date (Excel 2000)

    Good point Hans..
    What if it wasn't fixed? What I would like to do is keep it fixed, but add a string at the beginning of the date, and a string at the end of the date.

    Private Sub_cmbck

    Application.Worksheets(2).Cells(2, 1).Value = TextBox1.Value & Calendar1.Value _
    & TextBox3.Value

    how do I format the value of calendar1 as format(date,dd,mm,yy)?


    Thanks Darryl

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: format date (Excel 2000)

    Use the Format function in the code:

    Application.Worksheets(2).Cells(2, 1).Value = TextBox1.Value & Format(Calendar1.Value, "ddmmyy") _
    & TextBox3.Value

  5. #5
    4 Star Lounger
    Join Date
    May 2004
    Location
    Toronto, Ontario, Canada
    Posts
    425
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Re: format date (Excel 2000)

    Thanks Hans.

Posting Permissions

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