Hi, I am very elementary when it comes to creating macros and code. I have a macro that was given to me to run on data that I exported from an application with only certain columns. This macro is supposed to format the data as needed for meetings. I am trying to run the macro and getting the run time error 91. Please see my code below and let me know what I should do. Thank you!
Code:
Sub newBacklogFormat()
'
' newBacklogFormat Macro
'
'
Columns("C:C").Select
Selection.Cut
Columns("A:A").Select
ActiveSheet.Paste
Columns("C:C").Select
Selection.Delete Shift:=xlToLeft
Range("A1").Select
ActiveCell.FormulaR1C1 = "Priority"
Range("B1").Select
ActiveCell.FormulaR1C1 = "CR"
Range("C1").Select
ActiveCell.FormulaR1C1 = "Application"
Range("D1").Select
ActiveCell.FormulaR1C1 = "Summary"
Range("E1").Select
ActiveCell.FormulaR1C1 = "CR Type/Classification"
Range("F1").Select
ActiveCell.FormulaR1C1 = "CR Service Area"
Range("G1").Select
ActiveCell.FormulaR1C1 = "Status"
Range("H1").Select
ActiveCell.FormulaR1C1 = "Complexity"
Range("K1").Select
ActiveCell.FormulaR1C1 = "Scheduled End Date"
Range("H2").Select
ActiveWindow.ScrollColumn = 1
Cells.Select
Cells.EntireColumn.AutoFit
Columns("D:D").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.ColumnWidth = 57.44
Cells.Select
Cells.EntireRow.AutoFit
Range("A1:K15").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
Columns("E:F").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.ColumnWidth = 20.11
Columns("G:G").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.ColumnWidth = 17.78
Cells.Select
Cells.EntireColumn.AutoFit
Range("A2").Select
ActiveCell.FormulaR1C1 = "TBD"
Range("A3").Select
ActiveCell.FormulaR1C1 = "0"
Range("A4").Select
ActiveCell.FormulaR1C1 = "0"
Range("A5").Select
ActiveCell.FormulaR1C1 = "8"
Range("A6").Select
ActiveCell.FormulaR1C1 = "1"
Range("A7").Select
ActiveCell.FormulaR1C1 = "7"
Range("A8").Select
ActiveCell.FormulaR1C1 = "5"
Range("A9").Select
ActiveCell.FormulaR1C1 = "6"
Range("A10").Select
ActiveCell.FormulaR1C1 = "0"
Range("A11").Select
ActiveCell.FormulaR1C1 = "2"
Range("A12").Select
ActiveCell.FormulaR1C1 = "0"
Range("A13").Select
ActiveCell.FormulaR1C1 = "0"
Range("A14").Select
ActiveCell.FormulaR1C1 = "0"
Range("A15").Select
ActiveCell.FormulaR1C1 = "NEW"
Range("A16").Select
ActiveCell.FormulaR1C1 = ""
Columns("A:A").Select
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("A1:K15").Select
Selection.AutoFilter
Cells.Select
Cells.EntireColumn.AutoFit
Range("A1").Select
ActiveWorkbook.Worksheets("Sheet 1").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet 1").AutoFilter.Sort.SortFields.Add Key:= _
Range("A1:A15"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Sheet 1").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub