Hello,
I am having difficulties with the Select Case. I am constantly recieving an error code when I run macro. Here is a copy my code.
Sub RealTimeHistorical()
'
' RealTimeHistorical Macro
'
'
[For i = 2 To NumRows
'format start date so times are the same
Cells(1, 5) = Cells(1, 6) - 1
Select Case Cells(1, 3).Value
Case "FP + CCV"
Combo = "FPCC"
Case "PCCC"
Combo = "PCCC"
Case "HB / NARS"
Combo = "HBCC"
Case "OEF/OIF"
Combo = "CVCC"
End Select
Next]
[Sheets("Pipkins_schedhours").Select
Range("D2:G1389").Select
Selection.Copy
Sheets("Real Time Historical ").Select
Range("B2").Select
Application.CutCopyMode = False
Selection.Cut Destination:=Range("B3")
Range("B2:E2").Select
Sheets("Pipkins_schedhours").Select
Sheets("Pipkins_schedhours").Name = "Pipkins_schedhours"
Range("D2:G1389").Select
Selection.Copy
Sheets("Real Time Historical ").Select
Range("B2:E2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveWorkbook.Worksheets("Real Time Historical ").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Real Time Historical ").Sort.SortFields.Add Key:= _
Range("E3:E1389"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption _
:=xlSortNormal
ActiveWorkbook.Worksheets("Real Time Historical ").Sort.SortFields.Add Key:= _
Range("C3:C1389"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption _
:=xlSortNormal
With ActiveWorkbook.Worksheets("Real Time Historical ").Sort
.SetRange Range("B2:E1389")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("B2:E1389").Select
ActiveWorkbook.Worksheets("Real Time Historical ").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Real Time Historical ").Sort.SortFields.Add Key:= _
Range("E3:E1389"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption _
:=xlSortNormal
ActiveWorkbook.Worksheets("Real Time Historical ").Sort.SortFields.Add Key:= _
Range("C3:C1389"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption _
:=xlSortNormal
Columns("B:E").Select
ActiveWorkbook.Worksheets("Real Time Historical ").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Real Time Historical ").Sort.SortFields.Add Key:= _
Range("E2:E50000"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption _
:=xlSortNormal
ActiveWorkbook.Worksheets("Real Time Historical ").Sort.SortFields.Add Key:= _
Range("C2:C50000"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption _
:=xlSortNormal
With ActiveWorkbook.Worksheets("Real Time Historical ").Sort
.SetRange Range("B1:E50000")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("F2").Select
ActiveCell.FormulaR1C1 = "=WEEKNUM(RC[-3])"
Range("F2").Select
Selection.AutoFill Destination:=Range("F2:F1389"), Type:=xlFillDefault
Range("F2:F1389").Select
ActiveWindow.LargeScroll Down:=-2
ActiveWindow.ScrollRow = 682
ActiveWindow.ScrollRow = 584
ActiveWindow.ScrollRow = 390
ActiveWindow.ScrollRow = 293
ActiveWindow.ScrollRow = 1
End Sub]
Bookmarks