Run Time error 13

Darren Smith

Well-known Member
Joined
Nov 23, 2020
Messages
631
Office Version
  1. 2019
Platform
  1. Windows
This code below says Run-time error 13 on this row
VBA Code:
Set Tb = Body_And_Vehicle_Type_Form.TextBox6.
Can some somebody say why?

VBA Code:
Sub Wing_Stay_Length()

Dim Tb As TextBox
Dim ws As Worksheet

Set ws = ThisWorkbook.Worksheets("Job Card Master")
Set Tb = Body_And_Vehicle_Type_Form.TextBox6

Select Case Tb.Value

Case ("Transit")
ws.Range("G24").Value = "550mm"

Case ("Sprinter")
ws.Range("G24").Value = "550mm"

Case ("Master")
ws.Range("G24").Value = "465mm"

Case ("Movano")
ws.Range("G24").Value = "465mm"

Case ("NV400")
ws.Range("G24").Value = "465mm"

Case ("Boxer")
ws.Range("G24").Value = "465mm"

Case ("Ducato")
ws.Range("G24").Value = "465mm"

Case ("Relay")
ws.Range("G24").Value = "465mm"

End Select

End Sub
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
I would recomend
VBA Code:
Private Sub TextBox6_Change()
    Dim ws As Worksheet
    Set ws = ThisWorkbook.Worksheets("Job Card Master")
    Select Case Me.Value
    Case ("Transit")
        ws.Range("G24").Value = "550mm"
.
.
.
 
Upvote 0
You are welcome
And thank you for the feedback
Be happy & safe
 
Upvote 0
Other thing is i need the code to find the word "Wings" in column C then go over 3 columns then down 1 row then fill in the cell.
Rather than a hard Range cell of "G24".
Could you help Please?
 
Upvote 0
Other thing is i need the code to find the word "Wings" in column C then go over 3 columns then down 1 row then fill in the cell.
Maybe (not sure exactly what you mean by fill in the cell so the below just puts xxx in the cell)...
VBA Code:
Sub FindWings()
    Dim MyCell As Range

    Set MyCell = Columns("C").Find("Wings", , xlValues, xlWhole, xlByRows, xlNext, False)
    If Not MyCell Is Nothing Then MyCell.Offset(1, 3).Value = "xxx"

End Sub
 
Upvote 0
See the values I am trying to put into the cell below.
How can I join the cell range to these values?

VBA Code:
Select Case Me.Value

Case ("Transit")
ws.Range.Value = "550mm"

Case ("Sprinter")
ws.Range.Value = "550mm"

Case ("Master")
ws.Range.Value = "465mm"

Case ("Movano")
ws.Range.Value = "465mm"

Case ("NV400")
ws.Range.Value = "465mm"

Case ("Boxer")
ws.Range.Value = "465mm"

Case ("Ducato")
ws.Range.Value = "465mm"

Case ("Relay")
ws.Range.Value = "465mm"

End Select

End Sub
 
Upvote 0
VBA Code:
Dim MyCell As Range

    Set MyCell = ws.Columns("C").Find("Wings", , xlValues, xlWhole, xlByRows, xlNext, False).Offset(1, 3)
    If Not MyCell Is Nothing Then
    
        Select Case Me.Value

        Case ("Transit")
            MyCell.Value = "550mm"

        Case ("Sprinter")
            MyCell.Value = "550mm"

        Case ("Master")
            MyCell.Value = "465mm"

        Case ("Movano")
            MyCell.Value = "465mm"

        Case ("NV400")
            MyCell.Value = "465mm"

        Case ("Boxer")
            MyCell.Value = "465mm"

        Case ("Ducato")
            MyCell.Value = "465mm"

        Case ("Relay")
            MyCell.Value = "465mm"

        End Select

    End If
 
Last edited:
Upvote 0
Sorry does not work.
Would it be possible to send my workbook to you?
 
Upvote 0
No, you can upload it to a free file hosting site like www.box.com or www.dropbox.com, mark it for sharing then post the link it provides in the thread and someone will have a look at it.

Make sure that you have altered any sensitive data before uploading
 
Upvote 0

Forum statistics

Threads
1,215,432
Messages
6,124,858
Members
449,194
Latest member
HellScout

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