Closed Thread
Results 1 to 2 of 2

vba help !!

  1. #1
    Registered User
    Join Date
    08-03-2011
    Location
    New Orleans, Louisiana
    MS-Off Ver
    Excel 2003
    Posts
    1

    vba help !!

    Hello all I am a brand spankin new member here and need a little help with some vba code. Thanks ahead of time for the help !!

    Ok making progress but need a little more guidance, please..
    Have vba that copies a certain criteria from Gate Log rounds the total hours worked and then paste the data into the Timesheet
    see code below:

    Sub Test()
    Worksheets("Gate_Log").Range("A2:B300").Copy Worksheets("Timesheet").Range("B2")
    Worksheets("Gate_Log").Range("D2:D300").Copy Worksheets("Timesheet").Range("D2")
    Worksheets("Gate_Log").Range("E2:E300").Copy Worksheets("Timesheet").Range("L2")

    Dim OneCell As Range
    For Each OneCell In Range(Range("L2"), Range("L" & Rows.Count).End(xlUp))
    OneCell.Formula = "=Round(" & OneCell.Value & ",0)"
    Next OneCell
    End Sub


    what I need is to have the code automatically deduct 30 minutes from the total hours on the gate log and then round it to the nearest hour based on 30 minute scale and then paste that value in column L of Timesheet. Current code works great but is rounding up or down based on .50 scale wrather than .30 ,ie; 30 minutes.

    Example:
    Gate Log = 7.45 - 30 minutes = 7.15 then rounded = 7.00

    any help would be greatly appreciated.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: vba help !!

    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

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

Closed 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