+ Reply to Thread
Results 1 to 4 of 4

Macro that will find all times and add this formula

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    06-02-2014
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    235

    Macro that will find all times and add this formula

    Hello All,

    I am trying to crate a macro that will find the times on this sheet and add this formula in the yellow highlighted cells. =C15+TIME(6,30,0)

    The issue it it will be used on multiple time cards like this but they will not all be the exact same. The cards will all look like this but the times may not be on the same rows (they will be on the same columns though). In other words this card may populate more shift times and some fewer.

    I am attaching an example and the yellow highlights is where i need the formula to populate. As you can see in red font i did the first one. What i need this macro to find is the (start time plus 6 hrs and 30 minutes) in all highlighted areas.

    Any ideas will be greatly appreciated!
    Attached Files Attached Files

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,336

    Re: Macro that will find all times and add this formula

    Hi g1terra

    they will be on the same columns though
    Are you saying that the formula will only have to be entered in columns E and J

    If so then this should work...
    Have commented out loop through worksheets...You mentioned there might be more time cards...
    Option Explicit
    
    Sub FormulaInsert()
    Dim ws As Worksheet
    Dim Cell As Range
    Application.ScreenUpdating = False
    'For Each ws In ThisWorkbook.Sheets
        For Each Cell In ActiveSheet.Range("E:E,J:J")
            If Not IsEmpty(Cell.Offset(, -1).Value) And IsDate(Cell.Offset(, -1).Text) Then
                Cell.Value = Cell.Offset(, -2).Value + TimeSerial(6, 30, 0)
                Cell.NumberFormat = "hh:mm:ss"
            End If
        Next Cell
    'Next ws
    Application.ScreenUpdating = True
    End Sub
    Last edited by sintek; 08-26-2017 at 04:14 AM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  3. #3
    Forum Contributor
    Join Date
    06-02-2014
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    235

    Re: Macro that will find all times and add this formula

    Sorry I am having computer issues for some in San Juan curently, I did reply to this and for some reason it did not post. Thank you so much i actually called you a genius. Not good internet here..

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,336

    Re: Macro that will find all times and add this formula

    Coolio...
    For others...See amended code in this post....
    https://www.excelforum.com/excel-pro...un-faster.html

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 5
    Last Post: 09-17-2015, 10:43 AM
  2. Replies: 4
    Last Post: 01-06-2015, 05:51 PM
  3. [SOLVED] Macro for Text Search to Find Same Word Multiple Times
    By vcs1161 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-23-2014, 10:02 AM
  4. [SOLVED] Formula to find the number of times a row has the max value of the column
    By cheung in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-01-2014, 06:51 PM
  5. Need a Formula Find sections in a column and return start and end times
    By john dalton in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-27-2014, 05:42 AM
  6. Macro Loop – Find Specific Times, Extract Date, Average Values of Times
    By ExcelQuestFL in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-25-2010, 02:50 PM
  7. Macro to help sort date - times and average similar times.
    By ferretydeath in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-26-2008, 05:44 PM

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