Aaron DeYoung
New Member
- Joined
- Apr 23, 2014
- Messages
- 12
I a, a newer VBA user and I am having trouble running a Recorded and 'somewhat cleaned up' script. The following is part of what I have and Bold and Italicized is the problem part that keeps popping up with the Run time error 1004. I have tried an array of different things, but nothing has worked. Any help would be greatly appreciated. Thanks in advance!
Selection.AutoFill Destination:=Range("I2:I4223"), Type:=xlFillDefault
Range("I2:I4223").Select
Columns("I").Select
Selection.NumberFormat = "mm/dd/yyyy"
Columns("R").Select
Selection.NumberFormat = "mm/dd/yyyy"
Range("M2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC[-12],'Prior Month Training Report'!R[1]C[-12]:R[4218]C[5],13,FALSE)"
Selection.AutoFill Destination:=Range("M2:R2"), Type:=xlFillDefault
Range("M2:R2").Select
Selection.AutoFill Destination:=Range("M2:R4223"), Type:=xlFillDefault
Range("M2:R4223").Select
ActiveSheet.AutoFilterMode = False
ActiveSheet.Range("$A$1:$R$4223").AutoFilter
Rows("1:1").Select
Range("H1").Activate
ActiveSheet.Range("$A$1:$R$1").AutoFilter Field:=9, Criteria1:=Array( _
"#N/A"), Operator:=xlFilterValues, Criteria2:=Array(0, "1900")
Range("I2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
ActiveSheet.Range("$A$1:$R$4223").AutoFilter Field:=9
Selection.AutoFill Destination:=Range("I2:I4223"), Type:=xlFillDefault
Range("I2:I4223").Select
Columns("I").Select
Selection.NumberFormat = "mm/dd/yyyy"
Columns("R").Select
Selection.NumberFormat = "mm/dd/yyyy"
Range("M2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC[-12],'Prior Month Training Report'!R[1]C[-12]:R[4218]C[5],13,FALSE)"
Selection.AutoFill Destination:=Range("M2:R2"), Type:=xlFillDefault
Range("M2:R2").Select
Selection.AutoFill Destination:=Range("M2:R4223"), Type:=xlFillDefault
Range("M2:R4223").Select
ActiveSheet.AutoFilterMode = False
ActiveSheet.Range("$A$1:$R$4223").AutoFilter
Rows("1:1").Select
Range("H1").Activate
ActiveSheet.Range("$A$1:$R$1").AutoFilter Field:=9, Criteria1:=Array( _
"#N/A"), Operator:=xlFilterValues, Criteria2:=Array(0, "1900")
Range("I2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
ActiveSheet.Range("$A$1:$R$4223").AutoFilter Field:=9