This is my first time creating a Macro, so I apologize if I sound newbish.
I'm creating a macro that allows me to filter out certain values in a column.
I would then have to insert a new column, and enter either Yes or No in that same column, and I would like it to fill all the way down to the last row of that column (and the number of rows changes upon utilization of another worksheet)
I would have to repeat this step for the next 2 columns that I need to filter out.
So for instance, Filter column R and deselect some of the values. Insert a new columnin column B. Type "No" in that column and have it fill to the last row of the column.
My problem is, when I'm opening another worksheet to test to see if it works, the column with either Yes or No, follows the same pattern as the the worksheet where I've created the macro itself. Here is my code:
Sub DatatapeException()
'
' DatatapeException Macro
' Macro for datatape exception
'
' Keyboard Shortcut: Ctrl+Shift+M
'
Columns("A:A").Select
Selection.NumberFormat = "0"
Columns("B:B").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("B1").Select
ActiveCell.FormulaR1C1 = "Boardable?"
Range("A1").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$R$214").AutoFilter Field:=15, Criteria1:= _
"=Attachment does not exist in document place holder", Operator:=xlOr, _
Criteria2:="=Document place holder does not exist"
Range("B5").Select
ActiveCell.FormulaR1C1 = "N"
Range("B6").Select
ActiveCell.FormulaR1C1 = "N"
Range("B14").Select
ActiveCell.FormulaR1C1 = "N"
Range("B17").Select
ActiveCell.FormulaR1C1 = "N"
Range("B19").Select
ActiveCell.FormulaR1C1 = "N"
Range("B25").Select
ActiveCell.FormulaR1C1 = "N"
Range("B36").Select
ActiveCell.FormulaR1C1 = "N"
Range("B39").Select
ActiveCell.FormulaR1C1 = "N"
Range("B41").Select
ActiveCell.FormulaR1C1 = "N"
Range("B43").Select
ActiveCell.FormulaR1C1 = "N"
Range("B45").Select
ActiveCell.FormulaR1C1 = "N"
Range("B54").Select
ActiveCell.FormulaR1C1 = "N"
Range("B57").Select
ActiveCell.FormulaR1C1 = "N"
Range("B65").Select
ActiveCell.FormulaR1C1 = "N"
Range("B73").Select
ActiveCell.FormulaR1C1 = "N"
Range("B75").Select
ActiveCell.FormulaR1C1 = "N"
Range("B85").Select
ActiveCell.FormulaR1C1 = "N"
Range("B95").Select
ActiveCell.FormulaR1C1 = "N"
Range("B96").Select
ActiveCell.FormulaR1C1 = "N"
Range("B102").Select
ActiveCell.FormulaR1C1 = "N"
Range("B110").Select
ActiveCell.FormulaR1C1 = "N"
Range("B113").Select
ActiveCell.FormulaR1C1 = "N"
Range("B114").Select
ActiveCell.FormulaR1C1 = "N"
Range("B115").Select
ActiveCell.FormulaR1C1 = "N"
Range("B118").Select
ActiveCell.FormulaR1C1 = "N"
Range("B119").Select
ActiveCell.FormulaR1C1 = "N"
Range("B123").Select
ActiveCell.FormulaR1C1 = "N"
Range("B126").Select
ActiveCell.FormulaR1C1 = "N"
Range("B128").Select
ActiveCell.FormulaR1C1 = "N"
Range("B131").Select
ActiveCell.FormulaR1C1 = "N"
Range("B134").Select
ActiveCell.FormulaR1C1 = "N"
Range("B144").Select
ActiveCell.FormulaR1C1 = "N"
Range("B145").Select
ActiveCell.FormulaR1C1 = "N"
Range("B148").Select
ActiveCell.FormulaR1C1 = "N"
Range("B161").Select
ActiveCell.FormulaR1C1 = "N"
Range("B162").Select
ActiveCell.FormulaR1C1 = "N"
Range("B163").Select
ActiveCell.FormulaR1C1 = "N"
Range("B164").Select
ActiveCell.FormulaR1C1 = "N"
Range("B168").Select
ActiveCell.FormulaR1C1 = "N"
Range("B170").Select
ActiveCell.FormulaR1C1 = "N"
Range("B173").Select
ActiveCell.FormulaR1C1 = "N"
Range("B180").Select
ActiveCell.FormulaR1C1 = "N"
Range("B181").Select
ActiveCell.FormulaR1C1 = "N"
Range("B185").Select
ActiveCell.FormulaR1C1 = "N"
Range("B189").Select
ActiveCell.FormulaR1C1 = "N"
Range("B190").Select
ActiveCell.FormulaR1C1 = "N"
Range("B193").Select
ActiveCell.FormulaR1C1 = "N"
Range("B199").Select
ActiveCell.FormulaR1C1 = "N"
Range("B202").Select
ActiveCell.FormulaR1C1 = "N"
Range("B199").Select
ActiveSheet.Range("$A$1:$R$214").AutoFilter Field:=15
ActiveSheet.Range("$A$1:$R$214").AutoFilter Field:=13, Criteria1:=Array( _
"Attachment does not exist in document place holder", _
"Document place holder does not exist", _
"More than one current version files exist in the document"), Operator:= _
xlFilterValues
Range("B12").Select
ActiveCell.FormulaR1C1 = "N"
Range("B101").Select
ActiveCell.FormulaR1C1 = "N"
Range("B111").Select
ActiveCell.FormulaR1C1 = "N"
Range("B159").Select
ActiveCell.FormulaR1C1 = "N"
Range("B175").Select
ActiveCell.FormulaR1C1 = "N"
Range("B195").Select
ActiveCell.FormulaR1C1 = "N"
ActiveSheet.Range("$A$1:$R$214").AutoFilter Field:=13
ActiveSheet.Range("$A$1:$R$214").AutoFilter Field:=12, Criteria1:=Array( _
"Attachment does not exist in document place holder", _
"Document place holder does not exist", _
"Multiple documents exist with current version files"), Operator:= _
xlFilterValues
Range("B11").Select
ActiveCell.FormulaR1C1 = "N"
ActiveSheet.Range("$A$1:$R$214").AutoFilter Field:=12
ActiveSheet.Range("$A$1:$R$214").AutoFilter Field:=6, Criteria1:=Array( _
"Attachment does not exist in document place holder", _
"Document place holder does not exist", _
"More than one current version files exist in the document"), Operator:= _
xlFilterValues
ActiveSheet.Range("$A$1:$R$214").AutoFilter Field:=3, Criteria1:=Array( _
"InterestRateReductionRefinanceLoan", "StreamlineWithAppraisal", _
"StreamlineWithoutAppraisal"), Operator:=xlFilterValues
Range("B10").Select
ActiveCell.FormulaR1C1 = "N"
Range("B84").Select
ActiveCell.FormulaR1C1 = "N"
Range("B93").Select
ActiveCell.FormulaR1C1 = "N"
Range("B146").Select
ActiveCell.FormulaR1C1 = "N"
Range("B151").Select
ActiveCell.FormulaR1C1 = "N"
Range("B192").Select
ActiveCell.FormulaR1C1 = "N"
Range("B194").Select
ActiveCell.FormulaR1C1 = "N"
Range("B200").Select
ActiveCell.FormulaR1C1 = "N"
Range("B201").Select
ActiveCell.FormulaR1C1 = "N"
Range("B209").Select
ActiveCell.FormulaR1C1 = "N"
Range("C1").Select
ActiveSheet.Range("$A$1:$R$214").AutoFilter Field:=3
Range("F1").Select
ActiveSheet.Range("$A$1:$R$214").AutoFilter Field:=6
Range("E12").Select
Sheets.Add After:=Sheets(Sheets.Count)
Sheets("Sheet1").Select
Sheets("Sheet1").Name = "Boarded"
Sheets.Add After:=Sheets(Sheets.Count)
Sheets("Sheet2").Select
Sheets("Sheet2").Name = "Exception"
Sheets("Boarded").Select
With ActiveWorkbook.Sheets("Boarded").Tab
.ThemeColor = xlThemeColorAccent6
.TintAndShade = 0
End With
Sheets("Exception").Select
With ActiveWorkbook.Sheets("Exception").Tab
.Color = 255
.TintAndShade = 0
End With
Range("C29").Select
Sheets("10-9").Select
ActiveSheet.Range("$A$1:$R$214").AutoFilter Field:=2, Criteria1:="<>"
Cells.Select
Selection.Copy
Sheets("Exception").Select
Range("A1").Select
ActiveSheet.Paste
Sheets("10-9").Select
Range("C12").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = ""
ActiveSheet.Range("$A$1:$R$214").AutoFilter Field:=2, Criteria1:="="
Cells.Select
Selection.Copy
Sheets("Boarded").Select
Range("A1").Select
ActiveSheet.Paste
Cells.Select
Cells.EntireColumn.AutoFit
Range("E7").Select
Sheets("10-9").Select
Range("C18").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = ""
Range("G8").Select
Selection.AutoFilter
Range("F9").Select
End Sub
Please help.
Bookmarks