VPPANEER
10-12-2016, 12:16 PM
Hi There,
Below is my code, which i used to activate a workbook with partial file name but it it is showing error.
Kindly help to get this issue resolved.
Sub DRTN()
'
' DRTN Macro
'
'
Cells.Select
Range("Q1").Activate
Selection.AutoFilter
Selection.AutoFilter
Range("Q1").Select
ActiveSheet.Range("$A$1:$Y$1299").AutoFilter Field:=17, Criteria1:="IC1012"
Range("P1").Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
ActiveSheet.Previous.Select
ActiveSheet.Paste
Cells.Select
Selection.Columns.AutoFit
Columns("A:B").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
Columns("B:B").Select
Selection.Delete Shift:=xlToLeft
Columns("C:H").Select
Selection.Delete Shift:=xlToLeft
Selection.End(xlUp).Select
Columns("I:I").Select
Selection.Delete Shift:=xlToLeft
Selection.Delete Shift:=xlToLeft
Selection.Delete Shift:=xlToLeft
Selection.Delete Shift:=xlToLeft
Selection.End(xlUp).Select
Selection.End(xlToRight).Select
Columns("L:L").Select
Selection.Delete Shift:=xlToLeft
Range("I1").Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Range("C1").Select
ActiveCell.FormulaR1C1 = "Invoice #"
Range("D1").Select
ActiveCell.FormulaR1C1 = "Invoice Date"
Range("E1").Select
ActiveCell.FormulaR1C1 = "Amount"
Range("F1").Select
ActiveCell.FormulaR1C1 = "Currency"
Range("H1").Select
ActiveCell.FormulaR1C1 = "Vendor #"
Range("K1").Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Columns.AutoFit
Columns("G:G").Select
Selection.Delete Shift:=xlToLeft
Selection.Delete Shift:=xlToLeft
Selection.End(xlUp).Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Range("A1").Select
Workbooks("*Dump Aging Report* " & ".xls").Activate
End Sub
Below is my code, which i used to activate a workbook with partial file name but it it is showing error.
Kindly help to get this issue resolved.
Sub DRTN()
'
' DRTN Macro
'
'
Cells.Select
Range("Q1").Activate
Selection.AutoFilter
Selection.AutoFilter
Range("Q1").Select
ActiveSheet.Range("$A$1:$Y$1299").AutoFilter Field:=17, Criteria1:="IC1012"
Range("P1").Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
ActiveSheet.Previous.Select
ActiveSheet.Paste
Cells.Select
Selection.Columns.AutoFit
Columns("A:B").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
Columns("B:B").Select
Selection.Delete Shift:=xlToLeft
Columns("C:H").Select
Selection.Delete Shift:=xlToLeft
Selection.End(xlUp).Select
Columns("I:I").Select
Selection.Delete Shift:=xlToLeft
Selection.Delete Shift:=xlToLeft
Selection.Delete Shift:=xlToLeft
Selection.Delete Shift:=xlToLeft
Selection.End(xlUp).Select
Selection.End(xlToRight).Select
Columns("L:L").Select
Selection.Delete Shift:=xlToLeft
Range("I1").Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Range("C1").Select
ActiveCell.FormulaR1C1 = "Invoice #"
Range("D1").Select
ActiveCell.FormulaR1C1 = "Invoice Date"
Range("E1").Select
ActiveCell.FormulaR1C1 = "Amount"
Range("F1").Select
ActiveCell.FormulaR1C1 = "Currency"
Range("H1").Select
ActiveCell.FormulaR1C1 = "Vendor #"
Range("K1").Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Columns.AutoFit
Columns("G:G").Select
Selection.Delete Shift:=xlToLeft
Selection.Delete Shift:=xlToLeft
Selection.End(xlUp).Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Range("A1").Select
Workbooks("*Dump Aging Report* " & ".xls").Activate
End Sub