+ Reply to Thread
Results 1 to 7 of 7

Macro results for time displaying different than expected

  1. #1
    Registered User
    Join Date
    04-09-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    7

    Macro results for time displaying different than expected

    hi guys!

    I am having some problem with my macro all of a sudden...

    here's the macro>>>
    Please Login or Register  to view this content.
    Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #3 requires code tags. I have added them for you this time because you have a low post count. I also updated your title, and moved your thread. Please take care to do this yourself next time. --6StringJazzer

    the supposed output is,

    Column A = Name
    Column B = Date
    Column C = Login time >> format h:mm:ss AM/PM
    Column D = Logout time >> format h:mm:ss AM/PM
    Column D = employee code

    instead I am getting >>> (see Attachment)
    Attached Images Attached Images
    Last edited by 6StringJazzer; 03-20-2017 at 08:13 PM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Macro results for time displaying different than expected

    Please attach your workbook with the data in the state it is in before you run the macro.

    It looks like you have "macro recorder bloat." That obscures what the real problem is. It would help if you describe what your macro is supposed to do.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    04-09-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Macro results for time displaying different than expected

    thanks for the note 6stringJazzer and thank you for moving this to the correct location as well.

    one question, what's a code tag?

    as you may have already deduced, I am new in VBA...

    I have a raw data that I manipulate to get the first and last login,

    and then I paste it to the file with the macro that does the copying and pasting so that the hours won't have dates with them so that I can do calculations without excel thinking that I crossed 12midnight and not skew everything up.

    basically this is what it should look like

    Column A = Name
    Column B = Date
    Column C = Login time >> format h:mm:ss AM/PM
    Column D = Logout time >> format h:mm:ss AM/PM
    Column D = employee code

    also, a little background, the reason I have the first file that captures the first login and last logout is due because we moved to a different raw file

    the raw file that we use before, I wouldn't need to get the first login and logout first and manipulate the format, we already have it.

    I just paste it on my file and run the macro and it's all good to go.

    great link by the way.

    Attached the file before the macro, the csv tab is what I use the macro above with.
    Attached Files Attached Files

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Macro results for time displaying different than expected

    I will look at your file and see what I can do.

    In the meantime:

    Quote Originally Posted by Worldbreaker View Post
    one question, what's a code tag?
    When you post to this board, there are certain "tags" you can insert to affect the way your text is formatted. A CODE tag allows your code to be seen as it would in the VBA window, with spacing preserved. Otherwise, leading spaces and extra spaces are compressed out of your post (just like they are on any HTML page).

    So code looks like this without code tags:

    Dim i As Long
    Dim Count As Long
    For i = 1 to 10
    If Something Then
    DoSomething
    End If
    Next i

    And looks like this with code tags:
    Please Login or Register  to view this content.
    There are two ways to add code tags. One is to select the code part of the text so it is highlighted, then press the "#" button in the edit controls. The other is to simply type in the tags:

    [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code]

  5. #5
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Macro results for time displaying different than expected

    The file you attached does not have any code in it (it is not a macro-enabled file) and the code you posted above is not your complete code--the Sub statement is missing so I don't know what else might be missing. If you provide all of your code I can try to make some progress.

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Macro results for time displaying different than expected

    Also there is no sheet in your file called "Do Not Touch". So I don't see the context of where is the code and how you are running it.

  7. #7
    Registered User
    Join Date
    04-09-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Macro results for time displaying different than expected

    I was able to find the reason... and it's a comma!!! lol

    still, Thank you 6StringJazzer for your assistance

+ 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. macro: excel 2003(run) to excel 2016(problem)
    By brianjj in forum Excel Programming / VBA / Macros
    Replies: 29
    Last Post: 01-19-2017, 01:15 PM
  2. Problem with recording a macro with long formula - works in Excel but not in macro
    By tonybeo2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-28-2015, 11:25 AM
  3. [SOLVED] Excel Macro - Copy & Paste (Font) problem & Delete Last Added Rows problem
    By LennartB in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-05-2015, 06:58 AM
  4. [SOLVED] Problem when changing Macro from Excel 2007 (Windows) to Excel 2011 (Mac)
    By TrialandError80 in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 1
    Last Post: 01-02-2014, 07:26 AM
  5. Problem with Excel 2003 macro in Excel 2010.
    By madiaz in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-25-2013, 03:27 AM
  6. Excel macro problem
    By rishi in forum Excel General
    Replies: 2
    Last Post: 04-11-2007, 09:35 PM
  7. [SOLVED] Excel Bug or Macro Problem?
    By Don Wiss in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 08-03-2005, 12: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