Run Time error 438 - Object doesn't support this property or method

Gliffix101

Board Regular
Joined
Apr 1, 2014
Messages
81
Hello,

Below is a copy of the script I'm running. I have a form on "Search Form" tab that allows users to enter data into a particular cell and the form filters the "Combined" data sheet on these values. Today, I started getting this run time error on the LAST line of an IF statement (If Not str7 = "" Then Rng.AuotFilter Field:=161, Criteria1:=str7). I can update the form and str1, str2, str6, str3, and str4 all work. I am getting the issue on str7. Any ideas?

Code:
Sub Felicia_Template()


Dim LastRow As Long
Dim Rng As Range, str1 As String, str2 As String, strx As String, str3 As String, str4 As String, str5 As String, str6 As String, str7 As String
Dim i As Long, wsName As String, temp As String
Dim arrResults
Dim b As Long


Application.ScreenUpdating = False


With Sheets("Combined")
    LastRow = .Cells(Rows.Count, 1).End(xlUp).Row
    Set Rng = .Range("A1:FE" & LastRow)
End With


With Sheets("Search Form")
    str1 = .Range("E8").Text
    str2 = .Range("E12").Text
    str3 = .Range("E16").Text
    str4 = .Range("E20").Text
    str5 = .Range("L12").Text
    str6 = .Range("E24").Text
    str7 = .Range("E28").Text
End With


Sheets.Add After:=Sheets("Search Form")
ActiveSheet.Name = ("Results")
Sheets("Combined").Select
ActiveSheet.AutoFilterMode = False


Rng.AutoFilter Field:=6, Criteria1:="<>", Operator:=xlFilterValues


If y > 0 Then Rng.AutoFilter Field:=20, Criteria1:=(arrResults), Operator:=xlFilterValues
    If Not str1 = "" Then Rng.AutoFilter Field:=4, Criteria1:=str1
    If Not str2 = "" Then Rng.AutoFilter Field:=5, Criteria1:=str2
    If Not str6 = "" Then Rng.AutoFilter Field:=6, Criteria1:=str6
    If Not str3 = "" Then Rng.AutoFilter Field:=159, Criteria1:=str3
    If Not str4 = "" Then Rng.AutoFilter Field:=160, Criteria1:=str4
    If Not str7 = "" Then Rng.AuotFilter Field:=161, Criteria1:=str7
    
Rng.SpecialCells(xlCellTypeVisible).EntireRow.Copy Sheets("Results").Range("A1")


Application.CutCopyMode = False
Selection.AutoFilter
Sheets("Results").Activate
ActiveSheet.Columns.AutoFit


Worksheets("Results").Range("A:FE").Columns.AutoFit
Rows("2:99999").RowHeight = 15
Rows("1:1").Select
    Selection.Find(What:="Current Comment", After:=ActiveCell, LookIn:= _
        xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
        xlNext, MatchCase:=False, SearchFormat:=False).Activate
    ActiveCell.EntireColumn.Select
    Selection.ColumnWidth = 40


Sheets("Results").Activate
    Columns("BV:FD").Delete
    Columns("AQ:BR").Delete
    Columns("AI:AM").Delete
    Columns("AG:AG").Delete
    Columns("AE:AE").Delete
    Columns("AB:AC").Delete
    Columns("Z:Z").Delete
    Columns("X:X").Delete
    Columns("U:V").Delete
    Columns("R:R").Delete
    Columns("M:P").Delete
    Columns("G:K").Delete
    Columns("C:E").Delete
    
Columns("H:I").Insert Shift:=xlToRight
Range("H1").Value = "Outstanding Borrower Docs"
Range("I1").Value = "Date Last Contacted"
    
Sheets("Results").Activate
wsName = Format(Date, "mmddyy")
If WorksheetExists(wsName) Then
    temp = Left(wsName, 6)
    i = 1
    wsName = temp & "_" & i
    Do While WorksheetExists(wsName)
        i = i + 1
        wsName = temp & "_" & i
    Loop
End If


ActiveSheet.Name = wsName
Range("A1").Select




End Sub
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
have you checked out the spelling of Autofilter for str7 !!
 
Last edited:
Upvote 0
Haha - unbelievable!!! I was so focused on the strings and characters, I didn't even think about the spelling. Greatly appreciate the quick notice and response.
 
Upvote 0

Forum statistics

Threads
1,214,629
Messages
6,120,630
Members
448,973
Latest member
ChristineC

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top