Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 07-20-2017, 07:43 AM
NoSparks NoSparks is offline Advance one hour Windows 7 64bit Advance one hour Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default

Quote:
A doubt only, if there is some text in the schedule like for example vacations, appears error 13.
Every cell in your schedule is text, even the times are text not real times.

Provided none of your 'for example vacations' have a colon at the third character position this should do it.
Code:
Sub AdvanceTimes_v2()

    Dim tmp, cel As Range
    Dim firstTime As String
    Dim secondTime As String
    
With Sheets("Sheet1")
    For Each cel In .Range("B3:C25")
        If InStr(Trim(cel.Value), ":") = 3 Then
            tmp = Split(cel.Value, "-")
            firstTime = CStr(Format(DateAdd("h", 1, CDate(tmp(0))), "hh:mm"))
            secondTime = CStr(Format(DateAdd("h", 1, CDate(tmp(1))), "hh:mm"))
            cel.Value = firstTime & "-" & secondTime
        End If
    Next cel
End With
End Sub
Question... why are you using xls file when your profile indicates Office 2010 64bit ?
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting difference in time as a decimal and percentage of an hour shabbaranks Excel 2 05-23-2017 07:22 AM
Advance one hour 24 hour task calendar doesn't show a day?? benl Project 3 12-31-2015 02:55 PM
12 hour work days (shifts) John Franklin Project 22 11-12-2013 03:19 PM
Can Excel Deduct 30 Minutes from an 8 1/2 Hour Cell? tatihulot Excel 4 05-16-2013 04:30 PM
Advance one hour Half hour added between tasks maruchi Project 1 06-17-2010 08:06 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:54 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft