+ Reply to Thread
Results 1 to 5 of 5

Macro doesn't place results where I want them

  1. #1
    Registered User
    Join Date
    09-22-2008
    Location
    markham
    Posts
    52

    Macro doesn't place results where I want them

    Hello,

    I'm a macro newbie and have simply copied this macro to accomplish the task of timing the completion of an excel test.

    I would like the start time and stop time to appear at the top of a data range in cell A1 and B1 respectively. Using the code below, the start and stop times appear at the end of the data range (in column A and B).

    How can I fix this macro to accomplish my objective?

    Thank you.

    Brandy


    Please Login or Register  to view this content.
    Sorry about not posting my code correctly. It's my first time.

    Thanks for your patience and assistance.

    That worked perfectly! Thank you very much!
    Last edited by Brandy; 05-17-2011 at 03:37 PM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,224

    Re: Macro doesn't place results where I want them

    Please enclose your code in CODE Tags otherwise you will get few responses.

    While you are at it, please post a sample workbook so the code can be seen in context.

    Regards
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Valued Forum Contributor
    Join Date
    11-11-2008
    Location
    Euro
    MS-Off Ver
    2007, 2010
    Posts
    470

    Re: Macro doesn't place results where I want them

    I have tested your macro, it worked well

    What is the problem with you?

  4. #4
    Registered User
    Join Date
    09-22-2008
    Location
    markham
    Posts
    52

    Re: Macro doesn't place results where I want them

    Hi,

    You're right, the macro works, but I'd like those times to appear at the top of the worksheet, above the data.

    I have included a sample file. If would please have a look you will see what I mean.

    Thank you.
    Attached Files Attached Files

  5. #5
    Valued Forum Contributor
    Join Date
    11-11-2008
    Location
    Euro
    MS-Off Ver
    2007, 2010
    Posts
    470

    Re: Macro doesn't place results where I want them

    you should EDIT your post #1 to , please, enclose your code in CODE Tags (press last button on the top of edit-box) (that is one of forum rules)

    and the same code as your need
    Private Sub CommandButton1_Click()
    lngCol = IIf(CommandButton1.Caption = "Stop", 2, 1)
    Cells(1, lngCol) = Now()
    CommandButton1.Caption = IIf(CommandButton1.Caption = "Stop", "Start", "Stop")
    End Sub
    Last edited by tigertiger; 05-17-2011 at 03:28 PM.

+ 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