+ Reply to Thread
Results 1 to 6 of 6

TimeValue Type mismatch

  1. #1
    Registered User
    Join Date
    02-24-2019
    Location
    UK
    MS-Off Ver
    MS 365 PC & Mac (assume PC unless otherwise stated in post)
    Posts
    96

    TimeValue Type mismatch

    I am trying to adapt some code originally shared with me by @torachan, but really struggling with the column I am using for times;

    Can anyone spot anything I am doing wrong? I have added comment next to line in code that appears to be the problem.

    FYI column 2 contains date, column 4 a time and 6 a number (minutes)

    Please Login or Register  to view this content.

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

    Re: TimeValue Type mismatch

    The issue is the value in column 4 is not recognized as a time value. Without having seen your worksheet, it's difficult to recommend a solution.

    Please attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    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 Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: TimeValue Type mismatch

    [.... deleted by me; essentially the same as AlphaFrog ....]
    Last edited by joeu2004; 12-03-2020 at 06:46 AM.

  4. #4
    Registered User
    Join Date
    02-24-2019
    Location
    UK
    MS-Off Ver
    MS 365 PC & Mac (assume PC unless otherwise stated in post)
    Posts
    96

    Re: TimeValue Type mismatch

    Thanks for the interest in my issue, please see attached file,
    I also add some comments and screen shots on 'Description of error' sheet to explain how the issue is occuring
    Attached Files Attached Files

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

    Re: TimeValue Type mismatch

    The TimeValue function converts text into a serial time value. The cells in column G are already serial time values. You do not need the TimeValue function.

    Controls("TextBox" & i).Text = Format(.Range(sc, i), "hh:mm")

  6. #6
    Registered User
    Join Date
    02-24-2019
    Location
    UK
    MS-Off Ver
    MS 365 PC & Mac (assume PC unless otherwise stated in post)
    Posts
    96

    Re: TimeValue Type mismatch

    Thanks AlphaFrog, that solved the issue

+ 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. Type Mismatch
    By beric7 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-13-2016, 02:05 PM
  2. Run Type error 13 Type Mismatch
    By Affan Khan in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 11-13-2012, 12:58 PM
  3. [SOLVED] Run-type error 13 type mismatch
    By misop in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-05-2012, 04:08 AM
  4. [SOLVED] Type Mismatch: array or user defined type expected
    By ExcelMonkey in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-06-2006, 10:45 AM
  5. [SOLVED] Type mismatch using rnge as Range with Type 8 Input Box
    By STEVE BELL in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 12-03-2005, 01:10 AM
  6. [SOLVED] Help: Compile error: type mismatch: array or user defined type expected
    By lvcha.gouqizi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-31-2005, 05:05 PM
  7. type mismatch
    By John in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-02-2005, 10:05 AM

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