Run-time Error 438: object doesnt support this property or method

Bench

Board Regular
Joined
Aug 27, 2009
Messages
134
Can anyone help, i keep getting a "Run-time Error 438: object doesnt support this property or method" when i run the Find code below, i've bolded the section is highlights in the code.

Rich (BB code):
Sub Find_First()
    
    Dim FindString As String
    Dim Rng As Range
    FindString = InputBox("Enter a Search value")
    If Trim(FindString) <> "" Then
        With Sheets("LookupTables").Range("E:E")
            Set Rng = .Find(What:=FindString, _
                            After:=.Cells(.Cells.Count), _
                            LookIn:=xlValues, _
                            LookAt:=xlWhole, _
                            SearchOrder:=xlByRows, _
                            SearchDirection:=xlNext, _
                            MatchCase:=False)
            If Not Rng Is Nothing Then
                Application.Goto Rng, True
            Else
                MsgBox "Nothing found"
            End If
        End With
    End If
    ActiveCell.Offset(0, -4).Select
    Range("A1").Value = ActiveCell.Value
     
    With Sheets("LookupTables")
        .UserForm1.Enabled = True
    TextBox1.Text = .Range("LookupTables!A2").Value
    TextBox2.Text = .Range("LookupTables!A3").Value
    TextBox3.Text = .Range("LookupTables!A4").Value
    TextBox4.Text = .Range("LookupTables!A5").Value
    End With
End Sub

Any ideas?

Thanks
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Is it definitely on the Find line of code?
 
Upvote 0
i've bolded the section is highlights in the code.
What you bolded is this line:
.UserForm1.Enabled = True

which starts with a dot and it should not because even though it is in the With structure of
With Sheets("LookupTables")
a userform is not a method or property of a sheet.

Take away that preceding dot and only have
UserForm1.Enabled = True
(sans preceding dot) which will eliminate that error.

This does not mean you won't have other errors, but for sure you won't have that one.
 
Upvote 0
What you bolded is this line:
.UserForm1.Enabled = True

which starts with a dot and it should not because even though it is in the With structure of
With Sheets("LookupTables")
a userform is not a method or property of a sheet.

Take away that preceding dot and only have
UserForm1.Enabled = True
(sans preceding dot) which will eliminate that error.

This does not mean you won't have other errors, but for sure you won't have that one.

Great, had a play and looks like i needed to be more specific, changed to:

Code:
With Sheets("LookupTables")
    UserForm1.TextBox1.Text = Sheets("LookupTables").Range("LookupTables!A2").Value

Seems to have done the trick

Thanks
 
Upvote 0

Forum statistics

Threads
1,223,229
Messages
6,170,881
Members
452,364
Latest member
springate

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