+ Reply to Thread
Results 1 to 8 of 8

Thread: Simple Macro of VBA?

  1. #1
    Registered User
    Join Date
    01-26-2012
    Location
    toronto, canada
    MS-Off Ver
    Excel 2007
    Posts
    9

    Simple Macro of VBA?

    Hi Everyone,

    I am pretty new to VBA programming and macros in Excel.. here is what i am trying to do.

    Employee Start Time Stop Time
    Abby Mallard 6:00 7:00
    Abby Mallard 7:30 9:00
    Abby Mallard 10:00 10:30
    Abby Mallard 11:00 12:00
    Abby Mallard 1:00 3:30
    Abigail Gabble 7:00 10:00
    Abigail Gabble 8:00 9:00
    Abigail Gabble 2:00 2:15
    Abigail Gabble 2:30 2:45
    Abigail Gabble 2:50 3:00
    Abigail Gabble 3:30 4:30
    Al the Alligator 5:30 PM 7:00
    Al the Alligator 7:15 7;30
    Al the Alligator 8:00 2:00 AM

    From the test data above, for each employee i need to get their inital start time and their end stop time. I need to do this for about 450 employees. so for example, For Abby mallard, I need the start time of 6:00 am and the stop time of 3:30. The breaks in between are different for each employee as you see from the test data.. Is there anyway to write a macro that takes the employee's first start and last stop time and puts it in another sheet or row..

    so the end result that i want is:

    Employee: Start Time: End Time:
    Abby Mallard 6:00 3:30
    Abigail Gabble 7:00 4:30
    Al the Alligator 8:00 2:00

  2. #2
    Valued Forum Contributor MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    5,300

    Re: Simple Macro of VBA?

    Hi mveda2004 and welcome to the forum,

    I believe a Pivot Table that is grouped by day and shows the min time and max time would easily do your problem. If you could attach a sample workbook, I could show you how.
    To attach a file, click on "Go Advanced" and then on the Paper Clip Icon above the advanced message area.
    One test is worth a thousand opinions.
    Click the * below to say thanks.

  3. #3
    Registered User
    Join Date
    01-26-2012
    Location
    toronto, canada
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Simple Macro of VBA?

    i have attached the sample file.

    Thanks
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    5,300

    Re: Simple Macro of VBA?

    OK mveda from Toronto, Find the attached with what I imagined as your answer.
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * below to say thanks.

  5. #5
    Registered User
    Join Date
    01-26-2012
    Location
    toronto, canada
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Simple Macro of VBA?

    Hi Marvin,

    I tried what you said and it does not give me the values i want. the values i want for each employee are highlighed in yellow. I have tried putting the time in true excel time as well. Here is the different formats i tried working with.
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    5,300

    Re: Simple Macro of VBA?

    Hi,

    See my answer on the attached. I think you are not typing in your data correctly. You should use military time or AM and PM to get your times in.
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * below to say thanks.

  7. #7
    Registered User
    Join Date
    01-26-2012
    Location
    toronto, canada
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Simple Macro of VBA?

    Hi Marvin,

    I am sorry you are right.. thanks a lot this will save me a lot of work tommorrow!

  8. #8
    Forum Guru, retired Admin royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    25,640

    Re: Simple Macro of VBA?

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    PLEASE PM WHEN YOU HAVE DONE THIS AND I WILL DELETE THIS POST
    Hope that helps.

    RoyUK
    --------
    If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need

    For Excel Tips & Solutions, free examples and tutorials why not check out my downloads

    New members please read & follow the Forum Rules

    Remember to mark your questions Solved and rate the answer(s)

+ 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.2.0