crazybuckeyeguy
New Member
- Joined
- Apr 15, 2017
- Messages
- 49
just a simple copy and paste. add formula and fill down then copy, past and sort. What am I missing?
Sub Macro4()
'
' Macro4 Macro
Dim i As Long
Application.ScreenUpdating = False
i = Range("A" & Rows.Count).End(xlUp).Row
For i = lr To 2 Step -1
Range("n12:n" & i).Copy Range("E12:E" & i)
Range("O12").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=TIMEVALUE(RC[-1])"
Range("o12" & i).FillDown
Range("O12:O" & i).Select
Selection.Copy
Range("E12").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Columns("E:E").Select
Application.CutCopyMode = False
Selection.NumberFormat = "[$-en-US]h:mm AM/PM;@"
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add Key:=Range("E12:E" & i _
), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange Range("A11:Q" & i)
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Next I
Sub Macro4()
'
' Macro4 Macro
Dim i As Long
Application.ScreenUpdating = False
i = Range("A" & Rows.Count).End(xlUp).Row
For i = lr To 2 Step -1
Range("n12:n" & i).Copy Range("E12:E" & i)
Range("O12").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=TIMEVALUE(RC[-1])"
Range("o12" & i).FillDown
Range("O12:O" & i).Select
Selection.Copy
Range("E12").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Columns("E:E").Select
Application.CutCopyMode = False
Selection.NumberFormat = "[$-en-US]h:mm AM/PM;@"
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add Key:=Range("E12:E" & i _
), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange Range("A11:Q" & i)
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Next I