[Sub Macro1()
'
' Macro1 Macro
'
Dim wbCopy As Workbook
Dim wbCopy1 As Workbook
Dim wsCopy As Worksheet
Dim wbPaste As Workbook
Dim wsPaste As Worksheet
Dim wsPaste1 As Worksheet
Set wbCopy = Workbooks.Open("Q:\Global Reporting\Monthly reports\Jul 2014.xlsx")
Set wbCopy1 = Workbooks.Open("Q:\Global Reporting\Activity Stats\May 2014 - Jul 2014\Loans issued declined and cancelled RG.xlsx")
Set wsCopy = wbCopy.ActiveSheet
Set wsCopy1 = wbCopy.ActiveSheet
Options = InputBox(Prompt:="Employer Code", Title:="Options")
Options1 = InputBox(Prompt:="Employer Code", Title:="Options")
Options2 = InputBox(Prompt:="Employer Code", Title:="Options")
Options3 = InputBox(Prompt:="Employer Code", Title:="Options")
aCCOUNTS = InputBox(Prompt:="Scheme Code", Title:="Options")
aCCOUNTS1 = InputBox(Prompt:="Scheme Code", Title:="Options")
MyName = InputBox("Scheme Name")
Set wbPaste = Workbooks.Add
Set wsPaste = wbPaste.Sheets(1)
Set wsPaste1 = wbPaste.Sheets(2)
With wsCopy
.AutoFilterMode = False
With .Range("A2").CurrentRegion
.AutoFilter Field:=1, Criteria1:=Options
.SpecialCells(xlCellTypeVisible).Copy
wsPaste.Range("A1").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
With wsCopy
.AutoFilterMode = False
With .Range("A2").CurrentRegion
.AutoFilter Field:=1, Criteria1:=Options1
.Offset(1).SpecialCells(xlCellTypeVisible).Copy
wsPaste.Range("A1").End(xlDown).Offset(1, 0).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
With wsCopy
.AutoFilterMode = False
With .Range("A2").CurrentRegion
.AutoFilter Field:=1, Criteria1:=Options2
.Offset(1).SpecialCells(xlCellTypeVisible).Copy
wsPaste.Range("A1").End(xlDown).Offset(1, 0).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
With wsCopy
.AutoFilterMode = False
With .Range("A2").CurrentRegion
.AutoFilter Field:=1, Criteria1:=Options3
.Offset(1).SpecialCells(xlCellTypeVisible).Copy
wsPaste.Range("A1").End(xlDown).Offset(1, 0).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
With wbPaste
Range("A1").Select
Selection.CurrentRegion.Select
Selection.Copy
Range("A1").Select
ActiveSheet.Paste
Cells.Select
Cells.EntireColumn.AutoFit
Range("A1").Select
Columns("B:B").ColumnWidth = 30
Columns("E:E").ColumnWidth = 31
Columns("F:F").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
Columns("J:J").Select
Selection.Delete Shift:=xlToLeft
Columns("AD:AE").Select
Range("AE1").Activate
Selection.Delete Shift:=xlToLeft
Columns("W:Z").Select
Range("Z1").Activate
Selection.Delete Shift:=xlToLeft
Range("A1").Select
End With
Selection.CurrentRegion.Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
Range("B8").Select
Rows("1:1").Select
Selection.Font.Bold = True
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.ReadingOrder = xlContext
End With
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0.149998474074526
.PatternTintAndShade = 0
End With
With Selection.Font
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
End With
Cells.Select
With Selection.Font
.Name = "AraIL"
.Size = 11
.Underline = xlUnderlineStyleNone
.TintAndShade = 0
.ThemeFont = xlThemeFontMinor
End With
With Selection.Font
.Name = "Arial"
.Size = 8
.Underline = xlUnderlineStyleNone
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
Cells.EntireColumn.AutoFit
Range("B8").Select
Columns("B:B").ColumnWidth = 31
Columns("D:D").ColumnWidth = 6.14
Rows("1:1").EntireRow.AutoFit
Columns("D:D").ColumnWidth = 7
Range("E8").Select
Columns("E:E").ColumnWidth = 30.57
Columns("G:G").ColumnWidth = 13
Columns("K:K").Select
Selection.NumberFormat = "mm/dd/yy;@"
Columns("L:M").Select
Selection.NumberFormat = "mm/dd/yy;@"
Columns("L:M").Select
Selection.ColumnWidth = 8.29
Columns("N:P").Select
Range("P1").Activate
Selection.Delete Shift:=xlToLeft
Columns("N:O").Select
Selection.NumberFormat = "0.00"
Range("P11").Select
Columns("P:P").ColumnWidth = 9.43
ActiveWindow.SmallScroll ToRight:=3
Columns("Q:Q").Select
Selection.NumberFormat = "0.00"
Selection.ColumnWidth = 9.86
Columns("R:R").Select
Selection.Delete Shift:=xlToLeft
Selection.NumberFormat = "0.00"
Selection.ColumnWidth = 8.14
Selection.ColumnWidth = 8.57
Columns("S:S").Select
Selection.Delete Shift:=xlToLeft
Range("T2").Select
Columns("A:A").ColumnWidth = 7.86
ActiveWorkbook.SaveAs ("C:\Users\abek276\Desktop\TRUSTEE REPORTS\") & MyName
Workbooks("Jul 2014.xlsx").Close Savechanges = False
Application.DisplayAlerts = False
With wbCopy1
.AutoFilterMode = False
ActiveSheet.Range("$A$1:$V$3075").AutoFilter Field:=2, Criteria1:=aCCOUNTS
.AutoFilter Field:=1, Criteria1:=aCCOUNTS
.SpecialCells(xlCellTypeVisible).Copy
wsPaste1.Range("A1").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
With wbCopy1
.AutoFilterMode = False
With .Range("A2").CurrentRegion
.AutoFilter Field:=1, Criteria1:=aCCOUNTS1
.SpecialCells(xlCellTypeVisible).Copy
wsPaste1.Range("A1").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
With wsPaste1
Range("A1").Select
Selection.CurrentRegion.Select
Selection.Copy
Range("A1").Select
ActiveSheet.Paste
Cells.Select
Cells.EntireColumn.AutoFit
Range("A1:I1").Select
ActiveWindow.SmallScroll Down:=-18
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Cells.Select
Cells.EntireColumn.AutoFit
Range("E6:E7").Select
Range("E7").Activate
Columns("E:E").ColumnWidth = 38.29
Range("C13").Select
ActiveWorkbook.Save
ChDir "C:\Users\abek276\Desktop\TRUSTEE REPORTS"
End With
End With
End With
End With
End With
End With
End With
End With
End With
End Sub]
In my code above I am getting an error: "Object doesnt support this property or method" here:
With wbCopy1
.AutoFilterMode = False
Any advice will be appreciated.
Regards
Bookmarks