+ Reply to Thread
Results 1 to 15 of 15

Macro to paste value from userform label

Hybrid View

  1. #1
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Macro to paste value from userform label

    Maybe this format for the cell(s) would help:
    (Not sure what version of excel you are using...)
    Format Cells, Number, Custom, edit the format to:
    00:00:00.00
    This will show leading zeroes for Hours:Minutes:Seconds if they are ZERO, (which is what I understand that you are wanting?)

    Edit-
    OR
    hh:mm:ss.00
    as my first suggestion seems to fail
    Last edited by dredwolf; 06-11-2013 at 10:14 PM.
    A picture may be worth a thousand words, BUT, a sample Workbook is worth a thousand screenshots!
    -Add a File - click advanced (next to quick post), scroll to manage attachments, click, select add files, click select files, select file, click upload, when file shows up at bottom left, click done (bottom right), click submit
    -To mark thread Solved- go top of thread,click Thread Tools,click Mark as Solved
    If you received helpful response, please remember to hit the * of that post

  2. #2
    Forum Contributor
    Join Date
    12-16-2004
    Posts
    125

    Re: Macro to paste value from userform label

    I'm sorry for the confusion. I was trying to keep things simple and instead made it difficult. I intend to have a button on the userform for each row (not created yet). The button for row 7 will input the data from the label to J7:L7. The next time it is pressed it will input to M7:O7. The problem I'm having is when the hours and minutes show 00, everything shifts to the left one column. For example, if the label shows 01:15:22.17 then J7 shows 01, K7 shows 15, and L7 shows 22.17. If the label is 00:00:22.17, then J7 shows 00, K7 shows 22, and L7 shows 17. Instead J7 should show 00, K7 should show 00, and L7 should show 22.17. I hope this is clear and again I'm sorry for the confusion and the misleading workbook.

  3. #3
    Forum Contributor
    Join Date
    12-16-2004
    Posts
    125

    Re: Macro to paste value from userform label

    Hi Mordred,

    I'm sorry for all the confusion, but I really could use your help. I have reread my posts and realize how confusing they were. My first question was to only get the values from the label in the right cell. I wanted the hours in one cell, the minutes in the next cell, and the seconds and decimals together in the next cell. Your code worked great as long as the value in the label was more than 00:01:00.00 (one minute). If it was less than one minute the seconds and decimal values were placed in different cells. Once I knew how to get the values from the label in the right place I was going to use an If/Then arguement to place the values to the right, but your code anticipated this only down. If you or anyone is willing to help I would appreciate it.

    Thanks again.

  4. #4
    Forum Contributor
    Join Date
    12-16-2004
    Posts
    125

    Re: Macro to paste value from userform label

    I wanted to thank everyone who offered help. When this thread died out I posted on a different forum and found an answer. Here is a link for anyone who might be interested.

    http://www.ozgrid.com/forum/showthread.php?t=179744

    Thanks again for all your time.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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