run-time error 438 object does not support this property or method

nuttycow13

New Member
Joined
Feb 6, 2012
Messages
47
I have been getting this error: "run-time error 438 object does not support this property or method " when trying to get a click button to search a spread sheet find a value from the entered text box and then read the cells and input them into text boxes in another userform.

this is the code i have:

Private Sub Printer_Find_Click()

If Sitebox.Value = "UKCH" Then
Sheet2.Activate
ElseIf Sitebox.Value = "SDHQ" Then
Sheet1.Activate
ElseIf Sitebox.Value = "NLEI" Then
Sheet13.Activate
ElseIf Sitebox.Value = "USHW" Then
Sheet10.Activate
ElseIf Sitebox.Value = "SGSG" Then
Sheet11.Activate
End If

Range("B1").Avtive
Do While ActiveCell.Value <> ""
If ActiveCell.Value = Find_Printer.Text Then
Found_Printer_Name.Value = Cells(0, 2).Value
Found_Vaild.Value = Cells(0, 18).Value
Found_DNS.Value = Cells(0, 14).Value
Found_IP.Value = Cells(0, 12).Value
Found_Patch.Value = Cells(0, 7).Value
Found_Fax.Value = Cells(0, 10).Value
Found_Serial.Value = Cells(0, 6).Value
Found_Model.Value = Cells(0, 5).Value
Found_Make.Value = Cells(0, 4).Value
Found_Wing.Value = Cells(0, 8).Value
Found_Mac.Value = Cells(0, 11).Value
Found_Host.Value = Cells(0, 12).Value
Found_GIS.Value = Cells(0, 17).Value
Found_Comments.Value = Cells(0, 19).Value
Found_Type.Value = Cells(0, 3).Value
Found_Location.Value = Cells(0, 9).Value
Found_Site.Value = Sitebox.Value
Found_Number.Value = Numberbox.Value


End If

ActiveCell.Offset(1, 0).Activate
Loop

Unload Me

Found_Printer.Show vbModal

End Sub

it would be great if anyone could help me. thanks in advance
 
What happens if you rename the button or whatever the control is so it doesn't include an underscore?

Also, are there any other controls with a similar name, especially the first part 'Print'?
 
Upvote 0
i have tried renaming it nothing still the same but i have noticed that it seems to block out another section as well when it hightlights the First line. see code:

Private Sub Find_Click()

If Sitebox.Value = "UKCH" Then
Sheet2.Activate
ElseIf Sitebox.Value = "SDHQ" Then
Sheet1.Activate
ElseIf Sitebox.Value = "NLEI" Then
Sheet13.Activate
ElseIf Sitebox.Value = "USHW" Then
Sheet10.Activate
ElseIf Sitebox.Value = "SGSG" Then
Sheet11.Activate
End If

Range("B1:B9999").Activate
Do While ActiveCell.Value <> ""
If ActiveCell.Value = Find_Printer.Text Then
Found_Printer.Found_Printer_Name.Value = Cells(0, 2).Value
Found_Printer.Found_Vaild.Value = Cells(0, 18).Value
Found_Printer.Found_DNS.Value = Cells(0, 14).Value
Found_Printer.Found_IP.Value = Cells(0, 12).Value
Found_Printer.Found_Patch.Value = Cells(0, 7).Value
Found_Printer.Found_Fax.Value = Cells(0, 10).Value
Found_Printer.Found_Serial.Value = Cells(0, 6).Value
Found_Printer.Found_Model.Value = Cells(0, 5).Value
Found_Printer.Found_Make.Value = Cells(0, 4).Value
Found_Printer.Found_Wing.Value = Cells(0, 8).Value
Found_Printer.Found_Mac.Value = Cells(0, 11).Value
Found_Printer.Found_Host.Value = Cells(0, 12).Value
Found_Printer.Found_GIS.Value = Cells(0, 17).Value
Found_Printer.Found_Comments.Value = Cells(0, 19).Value
Found_Printer.Found_Type.Value = Cells(0, 3).Value
Found_Printer.Found_Location.Value = Cells(0, 9).Value
Found_Printer.Found_Site.Value = Sitebox.Value
Found_Printer.Found_Number.Value = Numberbox.Value

End If

ActiveCell.Offset(1, 0).Activate
Loop

Found_Printer.Show vbModal

End Sub
 
Upvote 0
Do you have any subs/controls/variables/elfs that share the same name?
 
Upvote 0
Why not upload the workbook somewhere, eg BoxNet, and post a link to it?
 
Upvote 0
When you get the error again check what's highlighted in blue, not yellow.

You might also want to check the name of one of your textboxes.
 
Upvote 0
yes i done that and showed you what the blue highlighted section was it was:

Found_Printer.Found_Printer_Name.Value = Cells(0, 2).Value

I dont understand why this is wrong.
 
Upvote 0
ok i have it so there is no error message but it still wont search column B for what is ever displayed in the text box and then output that row to the number of text boxes, it wont seem to search column B at all..
 
Upvote 0
You mention something about 'blocking out' a line of code but it wasn't clear what you meant.

Anyway, did you try my suggestion of looking at the control names?

There isn't one called Found_Printer_Name on the Found_Printer form.

There is a textbox called Printer_Name though.

Just found a few more - Vaild, DNS, Comments...

PS Wouldn't it be easier to remove the Found_ from in front of all the control names?
 
Upvote 0

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