Hello I am trying to get this to run a little quicker. I have many working codes MUCH LONGER that run quicker. Does anyone have any ideas. Here is the attached sheet and code.
Sub Add_Breaks()
Dim ws As Worksheet
Dim Cell As Range
Application.ScreenUpdating = False
'For Each ws In ThisWorkbook.Sheets
'Find 6.5 hrs mark
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"
End If
Next Cell
Columns("E:E").Select
Selection.NumberFormat = "[$-409]h:mm AM/PM;@"
Columns("J:J").Select
Selection.NumberFormat = "[$-409]h:mm AM/PM;@"
Cells.Select
Selection.Replace What:="blank", Replacement:="Min Break", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
'Highlight Blue
With Range("E:E, J:J")
.Font.Color = vbBlue
.Font.Bold = True
End With
'Colums Autofit
Columns("E:E").EntireColumn.AutoFit
Columns("J:J").EntireColumn.AutoFit
'Fix page break
ActiveWindow.View = xlPageBreakPreview
ActiveSheet.VPageBreaks(1).DragOff Direction:=xlToRight, RegionIndex:=1
ActiveSheet.PageSetup.PrintArea = "$A$1:$J$54"
ActiveWindow.View = xlNormalView
Range("A2").Select
Application.ScreenUpdating = True
End Sub
Bookmarks