+ Reply to Thread
Results 1 to 4 of 4

"Object doesnt support this property or method"

  1. #1
    Registered User
    Join Date
    04-03-2014
    Location
    Johannesburg
    MS-Off Ver
    Excel 2007
    Posts
    19

    "Object doesnt support this property or method"

    [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

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: "Object doesnt support this property or method"

    autofiltermode applies to a worksheet not a workbook
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Registered User
    Join Date
    04-03-2014
    Location
    Johannesburg
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: "Object doesnt support this property or method"

    @ JosephP - The reason for this is that this is applicable to sheet 2. The copy and paste on sheet 1 has been done already prior to this.

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: "Object doesnt support this property or method"

    you've gotta specify the sheet for autofiltermode-you can't apply it to a workbook object

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. error "object doesnt support ths property
    By VBA-Snail in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-22-2013, 10:45 AM
  2. "Object doesn't support this property or method" No idea what is wrong
    By jtakaine in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-18-2012, 02:21 PM
  3. Run-time error 438 "Object does not support this property or method"
    By SeagullWardy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-10-2012, 06:49 AM
  4. [SOLVED] Help "438 - Object doesn't support this property or method"
    By Jonthurston7 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-01-2011, 06:13 AM
  5. Incompatibility? "Object doesnt support this property or method"
    By tirades in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-30-2008, 06:07 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1