+ Reply to Thread
Results 1 to 2 of 2

Code to check if date being imported matches a previous date and time

  1. #1
    Forum Contributor
    Join Date
    10-02-2013
    Location
    Houston, TX
    MS-Off Ver
    office 365
    Posts
    638

    Code to check if date being imported matches a previous date and time

    12/2/2018 11:17:09 PM


    I am importing data off a sheet that has a date and time and I would like it to check the import and see if the date and time are the same and if they are produce a pop up asking that it looks to be the same data do you want to proceed. If they choose no to exit sub. I tried the code below but I keep getting a type mismatch error. on line " If TimeValue(OldTime) = TimeValue(MyDate) Then"

    Please Login or Register  to view this content.
    any thoughts

  2. #2
    Valued Forum Contributor PaulSP8's Avatar
    Join Date
    11-21-2017
    Location
    Chorley, England
    MS-Off Ver
    2013 & 2021
    Posts
    437

    Re: Code to check if date being imported matches a previous date and time

    Sounds to me as though OldTime or MyDate isn't in a format that TimeValue accepts, looking at your code you're trying to use the value with.

    It's hard to say for sure what is in your cells but you need to make sure your Variables are text (string) values as that is what TimeValue expects.

    Best bet would be to set a break point in the code and see what is actually in OldTime or MyDate - If it's serial number then there is your problem?

    If you can't get it working then upload a copy of your Workbook and we can take a look for ourselves

+ 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. Replies: 3
    Last Post: 10-31-2018, 01:12 PM
  2. Replies: 0
    Last Post: 02-25-2015, 01:02 PM
  3. [SOLVED] code that will check the date from a table if its MM/YY is current and if not then date=YY
    By richzter in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 05-24-2014, 10:27 PM
  4. [SOLVED] How to check whether a date is a month after the previous date
    By Bandicoot in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-12-2013, 07:26 AM
  5. [SOLVED] How do I convert imported date/time data to date/time format?
    By andykent99 in forum Excel General
    Replies: 4
    Last Post: 01-03-2013, 07:47 AM
  6. Replies: 2
    Last Post: 11-17-2011, 05:13 PM
  7. Imported Database Date/Time Stamp
    By nebraska_god in forum Excel General
    Replies: 2
    Last Post: 10-29-2009, 12:13 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