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
 

pgc01

MrExcel MVP
Joined
Apr 25, 2006
Messages
19,750
Hi

When the error occurs click on the debug button and check the code line that causes the error.

If you can't find any error in that line post back, indicating which line it is.
 

nuttycow13

New Member
Joined
Feb 6, 2012
Messages
47
Sorry i thought i had made bold the error line ok i will do below:


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

Thanks
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,651
That should be

Rich (BB code):
Range("B1").Activate
 

nuttycow13

New Member
Joined
Feb 6, 2012
Messages
47
thank you i dont know how i didnt see that looks like i have gone letter blind. i have now got problem in a different part code below:

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: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

the highlighted part is the code causing the problem cant figure out why ?
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
75,362
Office Version
365
Platform
Windows
Any error message?
 

nuttycow13

New Member
Joined
Feb 6, 2012
Messages
47
only thing it says is Compile error: Method or data member not found
 

nuttycow13

New Member
Joined
Feb 6, 2012
Messages
47
I was just thinking could it be because i am trying to reference a textbox within another userform to read the cell and input to ?
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
75,362
Office Version
365
Platform
Windows
Can I just check?

This is the line of code causing that error?

Private Sub Printer_Find_Click()
 

nuttycow13

New Member
Joined
Feb 6, 2012
Messages
47
yep when i step through it i get to that stage and the error flags up i cant get past this stage. which seems weird right ?
 

Forum statistics

Threads
1,082,025
Messages
5,362,733
Members
400,688
Latest member
ConnerR

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top