+ Reply to Thread
Results 1 to 4 of 4

convert time to string

  1. #1
    Forum Contributor
    Join Date
    02-09-2014
    Location
    Kamnik, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    693

    convert time to string

    Hi,

    I have this code for select case statement:

    Please Login or Register  to view this content.

    It counts data according to cell which is formatted as time ("hh:mm"). It should count according to first string in cell: If time begins with "0", "1" or "2".

    Somehow It doesn't recognize first character, I'm assuming time format has something to do with It. Formating cell to General or Number gets this working.

    So, what I need is to convert time value from cell into string(text). Tried this but not working :

    Please Login or Register  to view this content.
    How can I fix this ?

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: convert time to string

    Try this...

    Select Case Left(Format(.Cells(GlavaIme + 2, DateCol), "hh"), 1)
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: convert time to string

    Another method..

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    02-09-2014
    Location
    Kamnik, Slovenia
    MS-Off Ver
    Excel 2010
    Posts
    693

    Re: convert time to string

    Quote Originally Posted by AlphaFrog View Post
    Try this...

    Select Case Left(Format(.Cells(GlavaIme + 2, DateCol), "hh"), 1)
    Thanks, this one works fine ! Haven't tried second one though...

+ 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. Function to convert Time String to Time
    By Andibevan in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 06:05 PM
  2. Function to convert Time String to Time
    By Andibevan in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 10:05 AM
  3. [SOLVED] Function to convert Time String to Time
    By Andibevan in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 AM
  4. Function to convert Time String to Time
    By Andibevan in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM
  5. [SOLVED] Function to convert Time String to Time
    By Andibevan in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10:05 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