+ Reply to Thread
Results 1 to 7 of 7

Link commandbutton to textbox

  1. #1
    Forum Contributor
    Join Date
    04-27-2010
    Location
    Lisbon, Portugal
    MS-Off Ver
    Excel 2007
    Posts
    115

    Link commandbutton to textbox

    Hi,

    I have a userform with several textboxes and a command button to load the information to a worksheet (Database).

    In that worksheet, i have a column named "Finish Time"
    I need that, when the cmdbutton is clicked, it loads the current time (hh:mm:ss) to the column "Finish Time"

    Is that possible?
    Can anyone help me with the code?

    PS: The objective is to measure how long is the userform open. I have a textbox linked to userform_Initialize, so i'm guessing that i can do the same thing with userform_unload, but i can't seam to find the code.

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,013

    Re: Link commandbutton to textbox

    Just use something like:
    Please Login or Register  to view this content.
    adjusting sheet and columns to suit.
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Forum Contributor
    Join Date
    04-27-2010
    Location
    Lisbon, Portugal
    MS-Off Ver
    Excel 2007
    Posts
    115

    Re: Link commandbutton to textbox

    Thanks for the quick reply, but that's not exactly what i need

    I need to know how long do i take to: load form, fill in txtboxes and unload form.

    When i load the userform, i have this code associated to the txtstarttime.

    Please Login or Register  to view this content.
    Now i need that, when i unload the form, i get the finish time.

    I've tryed the code you suggested, but i cant' make it work.

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,013

    Re: Link commandbutton to textbox

    Just subtract the stored start time from Time() when you click the button and put that in the cell then.

  5. #5
    Forum Contributor
    Join Date
    04-27-2010
    Location
    Lisbon, Portugal
    MS-Off Ver
    Excel 2007
    Posts
    115

    Re: Link commandbutton to textbox

    Is there any way you'll tell me how to do that?

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,013

    Re: Link commandbutton to textbox

    Same basic code as before but instead of Now() you use
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    04-27-2010
    Location
    Lisbon, Portugal
    MS-Off Ver
    Excel 2007
    Posts
    115

    Re: Link commandbutton to textbox

    OK, thanks,

    I'll try to apllie it

+ 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