Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Aug 2001
    Location
    Cape Town, South Africa, South Africa
    Posts
    399
    Thanks
    0
    Thanked 0 Times in 0 Posts

    TRF FROM TEXTBOX TO WORKSHT (Excel 2000)

    I have a userbox with a textbox where a user will be entering a date. When I take the value to the worksheet (code: Textbox1.value = Range("A1") then it shows the date and time

    Thanks

    Mario

  2. #2
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: TRF FROM TEXTBOX TO WORKSHT (Excel 2000)

    Mario, I think that there are a couple of typos in your question, so let me rephrase the question:

    You have a userform with a textbox in which the user enters a date. When you move this date to the worksheet via Range("A1") = Textbox1, then you get both a date and a time.

    In Excel, the date and time are a single number -- the date is the integer part and the time is the fractional part, so you control what is seen by the cell's format. In your case, something like:<pre>Range("A1").NumberFormat = "mmmm d, yyyy"</pre>

    or some other date format. To see the possible date formats, use Excel (not VBA) help | Custom Format | Create a custom number format and follow the link at the bottom for "date or time." HTH --Sam
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

Posting Permissions

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