Consulting

Results 1 to 3 of 3

Thread: Solved: Date from textbox to cell

  1. #1

    Solved: Date from textbox to cell

    I am using the follwing code to transfer date from textbox on a user form to a cell:
    ActiveCell.Offset(0, 2).Value = Format(CDate(TextBox2.Value), "dd/mm/yyyy")
    But the date is transferred as "mm/dd/yyyy" format.
    My regional setting etc is in dd/mm/yyyy format. Also if I directly enter date in the cell, the date is saving well in dd/mm/yyyy format.
    What to do now to fix this problem?

  2. #2
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    Since the cell is formatted the way that you want it, the cell needs to be filled with the underlying value rather than the formatted value.

    [VBA]ActiveCell.Offset(0, 2).Value = CDate(TextBox2.Value)[/VBA]

  3. #3
    Thanks its working great now.

Posting Permissions

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