Option Private Module
Sub Vlookup_Step()
Application.ScreenUpdating = False
Sheets("Dat3").Select
Range("B2").Select
For I = ActiveSheet.UsedRange.Rows.Count To 1 Step -1
If Cells(3, 1).Value = "jayejaye" Or IsEmpty(Cells(3, 1)) Then
Exit Sub
Else
Sheets("Dat3").Select
Range("B2").Select
Range("B2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC1, Dat2!C[-1]:C17, 17, FALSE)"
Range("C2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC1, Dat2!C[-1]:C17, 16, FALSE)"
Range("D2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC1, Dat2!C[-1]:C17, 15, FALSE)"
Range("E2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC1, Dat2!C[-1]:C17, 14, FALSE)"
Range("F2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC1, Dat2!C[-1]:C17, 13, FALSE)"
Range("G2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC1, Dat2!C[-1]:C17, 12, FALSE)"
Range("H2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC1, Dat2!C[-1]:C17, 11, FALSE)"
Range("I2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC1, Dat2!C[-1]:C17, 10, FALSE)"
Range("J2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC1, Dat2!C[-1]:C17, 9, FALSE)"
Range("K2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC1, Dat2!C[-1]:C17, 8, FALSE)"
Range("L2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC1, Dat2!C[-1]:C17, 7, FALSE)"
Range("M2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC1, Dat2!C[-1]:C17, 6, FALSE)"
Range("N2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC1, Dat2!C[-1]:C17, 5, FALSE)"
Range("O2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC1, Dat2!C[-1]:C17, 4, FALSE)"
Range("P2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC1, Dat2!C[-1]:C17, 3, FALSE)"
End If
Next
Application.ScreenUpdating = True
End Sub
Sub Copy_Data()
Application.ScreenUpdating = False
Sheets("Sheet1").Select
Columns("A:A").Select
Selection.Copy
Sheets("Dat1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("A1").Select
Sheets("Dat2").Select
Columns("A:A").Select
Selection.Copy
Sheets("Dat3").Select
Columns("A:A").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("A1").Select
Application.ScreenUpdating = True
End Sub
Sub NEXT_PART()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Range("B2").Select
With ActiveCell
.AutoFill Destination:=Range(ActiveCell.Offset(, -1), ActiveCell.Offset(, -1).End(xlDown)).Offset(, 1)
End With
Range("C2").Select
With ActiveCell
.AutoFill Destination:=Range(ActiveCell.Offset(, -1), ActiveCell.Offset(, -1).End(xlDown)).Offset(, 1)
End With
Range("D2").Select
With ActiveCell
.AutoFill Destination:=Range(ActiveCell.Offset(, -1), ActiveCell.Offset(, -1).End(xlDown)).Offset(, 1)
End With
Range("E2").Select
With ActiveCell
.AutoFill Destination:=Range(ActiveCell.Offset(, -1), ActiveCell.Offset(, -1).End(xlDown)).Offset(, 1)
End With
Range("F2").Select
With ActiveCell
.AutoFill Destination:=Range(ActiveCell.Offset(, -1), ActiveCell.Offset(, -1).End(xlDown)).Offset(, 1)
End With
Range("G2").Select
With ActiveCell
.AutoFill Destination:=Range(ActiveCell.Offset(, -1), ActiveCell.Offset(, -1).End(xlDown)).Offset(, 1)
End With
Range("H2").Select
With ActiveCell
.AutoFill Destination:=Range(ActiveCell.Offset(, -1), ActiveCell.Offset(, -1).End(xlDown)).Offset(, 1)
End With
Range("I2").Select
With ActiveCell
.AutoFill Destination:=Range(ActiveCell.Offset(, -1), ActiveCell.Offset(, -1).End(xlDown)).Offset(, 1)
End With
Range("J2").Select
With ActiveCell
.AutoFill Destination:=Range(ActiveCell.Offset(, -1), ActiveCell.Offset(, -1).End(xlDown)).Offset(, 1)
End With
Range("K2").Select
With ActiveCell
.AutoFill Destination:=Range(ActiveCell.Offset(, -1), ActiveCell.Offset(, -1).End(xlDown)).Offset(, 1)
End With
Range("L2").Select
With ActiveCell
.AutoFill Destination:=Range(ActiveCell.Offset(, -1), ActiveCell.Offset(, -1).End(xlDown)).Offset(, 1)
End With
Range("M2").Select
With ActiveCell
.AutoFill Destination:=Range(ActiveCell.Offset(, -1), ActiveCell.Offset(, -1).End(xlDown)).Offset(, 1)
End With
Range("N2").Select
With ActiveCell
.AutoFill Destination:=Range(ActiveCell.Offset(, -1), ActiveCell.Offset(, -1).End(xlDown)).Offset(, 1)
End With
Range("O2").Select
With ActiveCell
.AutoFill Destination:=Range(ActiveCell.Offset(, -1), ActiveCell.Offset(, -1).End(xlDown)).Offset(, 1)
End With
Range("P2").Select
With ActiveCell
.AutoFill Destination:=Range(ActiveCell.Offset(, -1), ActiveCell.Offset(, -1).End(xlDown)).Offset(, 1)
End With
Range("Q2").Select
With ActiveCell
.AutoFill Destination:=Range(ActiveCell.Offset(, -1), ActiveCell.Offset(, -1).End(xlDown)).Offset(, 1)
End With
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
Sub last_Cell()
Range("a65536").End(xlUp).Offset(1, 0).Select
End Sub
Sub cell_offset()
ActiveCell.Offset(rowOffset:=0, columnOffset:=-1).Activate
End Sub
Sub NEXT_PART2()
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.Replace What:="#N/A", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Application.CutCopyMode = False
Range("A1").Select
MsgBox "Process Completed, Your Welcome"
End Sub
Sub clear_cells()
Sheets("Dat1").Select
Rows("2:2").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Rows("2:65535").Select
Selection.ClearContents
Sheets("Dat3").Select
Cells.Select
Selection.ClearContents
Range("A1").Select
Sheets("Dat2").Select
Cells.Select
Selection.ClearContents
Range("A1").Select
Sheets("Dat1").Select
Range("A2").Select
End Sub
Sub MoveRedA()
Application.ScreenUpdating = False
On Error Resume Next
Columns("A:A").Select ' CHANGE COLUMN CODE
Dim R As Range, r1 As Range
Dim cell As Range, cell1 As Range, S As String
Set R = Range(Cells(1, "A"), Cells(Rows.Count, "A").End(xlUp))
Columns(2).EntireColumn.Insert ' CHANGE COLUMN CODE
For Each cell In R
If cell.Font.ColorIndex = 3 Then
cell.Copy cell.Offset(0, 1)
cell.ClearContents
End If
Next
Columns("B:B").Select ' CHANGE COLUMN CODE
Selection.Font.ColorIndex = 1
End Sub
Sub MoveRedB()
Application.ScreenUpdating = False
Cells.Select
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("B1").Select
Call duplicates_In_Red
On Error Resume Next
Columns("B:B").Select ' CHANGE COLUMN CODE
Dim R As Range, r1 As Range
Dim cell As Range, cell1 As Range, S As String
Set R = Range(Cells(1, "B"), Cells(Rows.Count, "B").End(xlUp)) ' CHANGE COLUMN CODE
Columns(3).EntireColumn.Insert ' CHANGE COLUMN CODE
For Each cell In R
If cell.Font.ColorIndex = 3 Then
cell.Copy cell.Offset(0, 1)
cell.ClearContents
End If
Next
Columns("C:C").Select ' CHANGE COLUMN CODE
Selection.Font.ColorIndex = 1
End Sub
Sub MoveRedC()
Application.ScreenUpdating = False
Cells.Select
Selection.Sort Key1:=Range("C2"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("C1").Select
Call duplicates_In_Red
On Error Resume Next
Columns("C:C").Select ' CHANGE COLUMN CODE
Dim R As Range, r1 As Range
Dim cell As Range, cell1 As Range, S As String
Set R = Range(Cells(1, "C"), Cells(Rows.Count, "C").End(xlUp)) ' CHANGE COLUMN CODE
Columns(4).EntireColumn.Insert ' CHANGE COLUMN CODE
For Each cell In R
If cell.Font.ColorIndex = 3 Then
cell.Copy cell.Offset(0, 1)
cell.ClearContents
End If
Next
Columns("D:D").Select ' CHANGE COLUMN CODE
Selection.Font.ColorIndex = 1
End Sub
Sub MoveRedD()
Application.ScreenUpdating = False
Cells.Select
Selection.Sort Key1:=Range("D2"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("D1").Select
Call duplicates_In_Red
On Error Resume Next
Columns("D:D").Select ' CHANGE COLUMN CODE
Dim R As Range, r1 As Range
Dim cell As Range, cell1 As Range, S As String
Set R = Range(Cells(1, "D"), Cells(Rows.Count, "D").End(xlUp)) ' CHANGE COLUMN CODE
Columns(5).EntireColumn.Insert ' CHANGE COLUMN CODE
For Each cell In R
If cell.Font.ColorIndex = 3 Then
cell.Copy cell.Offset(0, 1)
cell.ClearContents
End If
Next
Columns("E:E").Select ' CHANGE COLUMN CODE
Selection.Font.ColorIndex = 1
End Sub
Sub MoveRedE()
Application.ScreenUpdating = False
Cells.Select
Selection.Sort Key1:=Range("E2"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("E1").Select
Call duplicates_In_Red
On Error Resume Next
Columns("E:E").Select ' CHANGE COLUMN CODE
Dim R As Range, r1 As Range
Dim cell As Range, cell1 As Range, S As String
Set R = Range(Cells(1, "E"), Cells(Rows.Count, "E").End(xlUp)) ' CHANGE COLUMN CODE
Columns(6).EntireColumn.Insert ' CHANGE COLUMN CODE
For Each cell In R
If cell.Font.ColorIndex = 3 Then
cell.Copy cell.Offset(0, 1)
cell.ClearContents
End If
Next
Columns("F:F").Select ' CHANGE COLUMN CODE
Selection.Font.ColorIndex = 1
End Sub
Sub MoveRedF()
Application.ScreenUpdating = False
Cells.Select
Selection.Sort Key1:=Range("F2"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("F1").Select
Call duplicates_In_Red
On Error Resume Next
Columns("F:F").Select ' CHANGE COLUMN CODE
Dim R As Range, r1 As Range
Dim cell As Range, cell1 As Range, S As String
Set R = Range(Cells(1, "F"), Cells(Rows.Count, "F").End(xlUp)) ' CHANGE COLUMN CODE
Columns(7).EntireColumn.Insert ' CHANGE COLUMN CODE
For Each cell In R
If cell.Font.ColorIndex = 3 Then
cell.Copy cell.Offset(0, 1)
cell.ClearContents
End If
Next
Columns("G:G").Select ' CHANGE COLUMN CODE
Selection.Font.ColorIndex = 1
End Sub
Sub MoveRedG()
Application.ScreenUpdating = False
Cells.Select
Selection.Sort Key1:=Range("G2"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("G1").Select
Call duplicates_In_Red
On Error Resume Next
Columns("G:G").Select ' CHANGE COLUMN CODE
Dim R As Range, r1 As Range
Dim cell As Range, cell1 As Range, S As String
Set R = Range(Cells(1, "G"), Cells(Rows.Count, "G").End(xlUp)) ' CHANGE COLUMN CODE
Columns(8).EntireColumn.Insert ' CHANGE COLUMN CODE
For Each cell In R
If cell.Font.ColorIndex = 3 Then
cell.Copy cell.Offset(0, 1)
cell.ClearContents
End If
Next
Columns("H:H").Select ' CHANGE COLUMN CODE
Selection.Font.ColorIndex = 1
End Sub
Sub MoveRedH()
Application.ScreenUpdating = False
Cells.Select
Selection.Sort Key1:=Range("H2"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("H1").Select
Call duplicates_In_Red
On Error Resume Next
Columns("H:H").Select ' CHANGE COLUMN CODE
Dim R As Range, r1 As Range
Dim cell As Range, cell1 As Range, S As String
Set R = Range(Cells(1, "H"), Cells(Rows.Count, "H").End(xlUp)) ' CHANGE COLUMN CODE
Columns(9).EntireColumn.Insert ' CHANGE COLUMN CODE
For Each cell In R
If cell.Font.ColorIndex = 3 Then
cell.Copy cell.Offset(0, 1)
cell.ClearContents
End If
Next
Columns("I:I").Select ' CHANGE COLUMN CODE
Selection.Font.ColorIndex = 1
End Sub
Sub MoveRedI()
Application.ScreenUpdating = False
Cells.Select
Selection.Sort Key1:=Range("I2"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("I1").Select
Call duplicates_In_Red
On Error Resume Next
Columns("I:I").Select ' CHANGE COLUMN CODE
Dim R As Range, r1 As Range
Dim cell As Range, cell1 As Range, S As String
Set R = Range(Cells(1, "I"), Cells(Rows.Count, "I").End(xlUp)) ' CHANGE COLUMN CODE
Columns(10).EntireColumn.Insert ' CHANGE COLUMN CODE
For Each cell In R
If cell.Font.ColorIndex = 3 Then
cell.Copy cell.Offset(0, 1)
cell.ClearContents
End If
Next
Columns("J:J").Select ' CHANGE COLUMN CODE
Selection.Font.ColorIndex = 1
End Sub
Sub MoveRedJ()
Application.ScreenUpdating = False
Cells.Select
Selection.Sort Key1:=Range("J2"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("J1").Select
Call duplicates_In_Red
On Error Resume Next
Columns("J:J").Select ' CHANGE COLUMN CODE
Dim R As Range, r1 As Range
Dim cell As Range, cell1 As Range, S As String
Set R = Range(Cells(1, "J"), Cells(Rows.Count, "J").End(xlUp)) ' CHANGE COLUMN CODE
Columns(11).EntireColumn.Insert ' CHANGE COLUMN CODE
For Each cell In R
If cell.Font.ColorIndex = 3 Then
cell.Copy cell.Offset(0, 1)
cell.ClearContents
End If
Next
Columns("K:K").Select ' CHANGE COLUMN CODE
Selection.Font.ColorIndex = 1
End Sub
Sub MoveRedK()
Application.ScreenUpdating = False
Cells.Select
Selection.Sort Key1:=Range("K2"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("K1").Select
Call duplicates_In_Red
On Error Resume Next
Columns("K:K").Select ' CHANGE COLUMN CODE
Dim R As Range, r1 As Range
Dim cell As Range, cell1 As Range, S As String
Set R = Range(Cells(1, "K"), Cells(Rows.Count, "K").End(xlUp)) ' CHANGE COLUMN CODE
Columns(12).EntireColumn.Insert ' CHANGE COLUMN CODE
For Each cell In R
If cell.Font.ColorIndex = 3 Then
cell.Copy cell.Offset(0, 1)
cell.ClearContents
End If
Next
Columns("L:L").Select ' CHANGE COLUMN CODE
Selection.Font.ColorIndex = 1
End Sub
Sub MoveRedL()
Application.ScreenUpdating = False
Cells.Select
Selection.Sort Key1:=Range("L2"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("L1").Select
Call duplicates_In_Red
On Error Resume Next
Columns("L:L").Select ' CHANGE COLUMN CODE
Dim R As Range, r1 As Range
Dim cell As Range, cell1 As Range, S As String
Set R = Range(Cells(1, "L"), Cells(Rows.Count, "L").End(xlUp)) ' CHANGE COLUMN CODE
Columns(13).EntireColumn.Insert ' CHANGE COLUMN CODE
For Each cell In R
If cell.Font.ColorIndex = 3 Then
cell.Copy cell.Offset(0, 1)
cell.ClearContents
End If
Next
Columns("M:M").Select ' CHANGE COLUMN CODE
Selection.Font.ColorIndex = 1
End Sub
Sub MoveRedM()
Application.ScreenUpdating = False
Cells.Select
Selection.Sort Key1:=Range("M2"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("M1").Select
Call duplicates_In_Red
On Error Resume Next
Columns("M:M").Select ' CHANGE COLUMN CODE
Dim R As Range, r1 As Range
Dim cell As Range, cell1 As Range, S As String
Set R = Range(Cells(1, "M"), Cells(Rows.Count, "M").End(xlUp)) ' CHANGE COLUMN CODE
Columns(14).EntireColumn.Insert ' CHANGE COLUMN CODE
For Each cell In R
If cell.Font.ColorIndex = 3 Then
cell.Copy cell.Offset(0, 1)
cell.ClearContents
End If
Next
Columns("N:N").Select ' CHANGE COLUMN CODE
Selection.Font.ColorIndex = 1
End Sub
Sub MoveRedN()
Application.ScreenUpdating = False
Cells.Select
Selection.Sort Key1:=Range("N2"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("N1").Select
Call duplicates_In_Red
On Error Resume Next
Columns("N:N").Select ' CHANGE COLUMN CODE
Dim R As Range, r1 As Range
Dim cell As Range, cell1 As Range, S As String
Set R = Range(Cells(1, "N"), Cells(Rows.Count, "N").End(xlUp)) ' CHANGE COLUMN CODE
Columns(15).EntireColumn.Insert ' CHANGE COLUMN CODE
For Each cell In R
If cell.Font.ColorIndex = 3 Then
cell.Copy cell.Offset(0, 1)
cell.ClearContents
End If
Next
Columns("O:O").Select ' CHANGE COLUMN CODE
Selection.Font.ColorIndex = 1
Application.ScreenUpdating = True
End Sub
Sub COLUMN_RANGE()
Dim R As Range, r1 As Range
Set R = Selection(1)
Set r1 = Cells(Rows.Count, R.Column).End(xlUp)
If r1.Row >= R.Row Then
Range(R, r1).Select
On Error GoTo 0
End If
End Sub
Sub duplicates_In_Red()
Call COLUMN_RANGE
Application.ScreenUpdating = False
'
' SELECT RANGE FIRST
'try adding and removing the (End If) as will only work if you have an if statement inserted
'
Rng = Selection.Rows.Count
For I = Rng To 1 Step -1
myCheck = ActiveCell
ActiveCell.Offset(1, 0).Select
For j = 1 To I
If ActiveCell = myCheck Then
Selection.Font.Bold = False
Selection.Font.ColorIndex = 3
End If
ActiveCell.Offset(1, 0).Select
Next j
ActiveCell.Offset(-I, 0).Select
Next I
End Sub