+ Reply to Thread
Results 1 to 5 of 5

Convert a Textbox to a time format

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    04-16-2014
    Location
    Australia
    MS-Off Ver
    Excel 365
    Posts
    125

    Convert a Textbox to a time format

    Hi all.

    Is there a way to convert a forms textbox which appears as a minutes and seconds(m:ss) to an actual time format in a particular cell.

    When I link the textbox to a cell via the properties it comes in as text (obviously).
    I would like a Private Sub Textbox_Change() that will convert the value to a genuine time, so it can be used as a timer.

    Thank you

    Yoepy.

  2. #2
    Valued Forum Contributor dotchiejack's Avatar
    Join Date
    05-21-2015
    Location
    Antwerp,Belgium
    MS-Off Ver
    2016
    Posts
    507

    Re: Convert a Textbox to a time format

    Do you mean this?
    TextBox1.value= format(TextBox1.value,"hh:mm:ss")
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Contributor
    Join Date
    04-16-2014
    Location
    Australia
    MS-Off Ver
    Excel 365
    Posts
    125

    Re: Convert a Textbox to a time format

    Sort of dotchiejack. My problem is I need just "m:ss".

    I want to enter, for example 1:25 in the textbox and get the result of 00:01:25 in cell "A1". But what I am getting is 01:25:00

  4. #4
    Registered User
    Join Date
    06-23-2019
    Location
    United States
    MS-Off Ver
    Outlook
    Posts
    6

    Re: Convert a Textbox to a time format

    ‘declare a variable as integer

    ‘name your text box as Textbox1

    Dim textboxValue as Integer
    textboxValue = Textbox1.Value
    By using the value property of textbox any number enter into the textbox will be converted from text to number. After that you can do any mathematical operations just any integer.

    Eg:

    Msgbox “square of the number is ” & _
    textboxValue * textboxValue

  5. #5
    Forum Contributor
    Join Date
    04-16-2014
    Location
    Australia
    MS-Off Ver
    Excel 365
    Posts
    125

    Re: Convert a Textbox to a time format

    Thanks evelyn, That works.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Convert Text Time From A Userform Textbox to A Time Value
    By Jenn68 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-21-2019, 09:53 PM
  2. Macro to Convert Time Format and Filter Into Columns By Time
    By dizjackson in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-24-2018, 06:40 PM
  3. Convert date and time in serial number format to text format
    By nda13112 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-11-2013, 02:45 PM
  4. Excel: How to convert time format into number format that can be added?
    By Frances Jones in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-17-2012, 04:10 PM
  5. How do I format a textbox with time
    By Jennifer in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-13-2006, 01:27 AM
  6. [SOLVED] format textbox to time
    By ASU in forum Excel General
    Replies: 3
    Last Post: 06-07-2006, 05:10 PM
  7. [SOLVED] Format As TIME In A TextBox
    By Minitman in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-08-2005, 09:06 PM

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