Can someone tell me how to combine the following 2 sets of code? When I combine they don't work properly
NUMBER 1
Sub LAUREN2()
'
' LAUREN4 Macro
'
'
Columns("E:E").Select
Application.CutCopyMode = False
Selection.Insert Shift:=xlToRight
Range("E1").Select
ActiveCell.FormulaR1C1 = "CAR MARK"
Range("E2").Select
ActiveCell.FormulaR1C1 = "=CONCATENATE(RC[-2],"" "",RC[-1])"
Selection.AutoFill Destination:=Range("E2:E2574")
Range("E2:E2574").Select
Columns("E:E").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Rows("2:2").Select
With ActiveWindow
.SplitColumn = 0
.SplitRow = 1
End With
ActiveWindow.FreezePanes = True
Range("A1:L2574").Select
Range("A2").Activate
Application.CutCopyMode = False
ActiveWorkbook.ActiveSheet.Sort.SortFields.Clear
ActiveWorkbook.ActiveSheet.Sort.SortFields.Add Key:=Range( _
"B2:B2574"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
xlSortNormal
With ActiveWorkbook.ActiveSheet.Sort
.SetRange Range("A1:L2574")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Columns("A:A").Select
Selection.Insert Shift:=xlToRight
Range("A2").Select
ActiveCell.FormulaR1C1 = "=CONCATENATE(RC[2],RC[3],RC[4])"
Selection.AutoFill Destination:=Range("A2:A2574")
Range("A2:A2574").Select
Range("L2").Select
ActiveCell.FormulaR1C1 = _
"=SUMIF(R[1]C[-11]:R2574C1,RC[-11],R[1]C[-1]:R2574C11)"
Range("L3").Select
ActiveWindow.SmallScroll Down:=-3
Range("L2").Select
Selection.AutoFill Destination:=Range("L2:L2574")
Range("L2:L2574").Select
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("M2").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=SUM(RC[-2]:RC[-1])"
Range("M2").Select
Selection.AutoFill Destination:=Range("M2:M2574")
Range("M2:M2574").Select
Range("A1:M2574").Select
Range("M2").Activate
ActiveWorkbook.ActiveSheet.Sort.SortFields.Clear
ActiveWorkbook.ActiveSheet.Sort.SortFields.Add Key:=Range( _
"M2:M2574"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
xlSortNormal
With ActiveWorkbook.ActiveSheet.Sort
.SetRange Range("A1:M2574")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("M25").Select
Selection.End(xlDown).Select
Range("K2575").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-2573]C:R[-1]C)"
Range("L2575").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-2573]C:R[-1]C)"
Range("M2575").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-2573]C:R[-1]C)"
Range("K2575:M2575").Select
Selection.Style = "Currency"
Range("K2574:M2574").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
Application.ScreenUpdating = 0
With ActiveSheet
With .[a1].CurrentRegion
.AutoFilter 3, 50
.AutoFilter 4, 0
.AutoFilter 5, 50
End With
.UsedRange.Offset(1).EntireRow.Delete
.AutoFilterMode = 0
End With
Application.ScreenUpdating = 1
End With
End Sub
NUMBER 2
Sub test()
Application.ScreenUpdating = 0
With ActiveSheet
With .[a1].CurrentRegion
.AutoFilter 3, 50
.AutoFilter 4, 0
.AutoFilter 5, 50
End With
.UsedRange.Offset(1).EntireRow.Delete
.AutoFilterMode = 0
End With
Application.ScreenUpdating = 1
End Sub
Bookmarks