userform to worksheet selection incorrect

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,226
Office Version
  1. 2007
Platform
  1. Windows
Evening,
For the last hour ive been having an issue with my form but dont find the answer.

I am also unable to visit the selected item in userform on the worksheet,see screen shot.
I select VAUXHALL ZAFIRA on the userform but im taken to anything but.
I think its to do with the red hilight but changing it still doesnt select the correct item

Rich (BB code):
Private Sub ListBox1_Click()
  Range("E" & ListBox1.List(ListBox1.ListIndex, -4)).Select
  Unload CloningSearch
End Sub
Private Sub TextBox1_Change()
  Dim r As Range, f As Range, cell As String, added As Boolean
  Dim sh As Worksheet
  
  Set sh = Sheets("CLONING")
  sh.Select
  With ListBox1
    .Clear
    .ColumnCount = 6
    .ColumnWidths = "190;150;75;120;110;30"
    If TextBox1.Value = "" Then Exit Sub
    Set r = Range("E2", Range("E" & Rows.Count).End(xlUp))
    Set f = r.Find(TextBox1.Value, LookIn:=xlValues, lookat:=xlPart)
    If Not f Is Nothing Then
      cell = f.Address
      Do
        added = False
        For i = 0 To .ListCount - 1
          Select Case StrComp(.List(i), f.Value, vbTextCompare)
            Case 0, 1
              .AddItem f.Value, i
              .List(i, 6) = f.Row                 'ROW NUMBER
              .List(i, 1) = f.Offset(, -2).Value  'MY CHIP USED
              .List(i, 2) = f.Offset(, -1).Value  'YEAR
              .List(i, 3) = f.Offset(, -3).Value  'CUSTOMERS CHIP TYPE
              .List(i, 4) = f.Offset(, -4).Value  'CUSTOMERS CHIP ID
              .List(i, 5) = f.Offset(, 1).Value    'TOOL USED

              added = True
              Exit For
          End Select
        Next
        If added = False Then
              .AddItem f.Value
              .List(.ListCount - 1, 6) = f.Row                 'ROW NUMBER
              .List(.ListCount - 1, 1) = f.Offset(, -2).Value  'MY CHIP USED
              .List(.ListCount - 1, 2) = f.Offset(, -1).Value  'YEAR
              .List(.ListCount - 1, 3) = f.Offset(, -3).Value  'CUSTOMERS CHIP TYPE
              .List(.ListCount - 1, 4) = f.Offset(, -4).Value  'CUSTOMERS CHIP ID
              .List(.ListCount - 1, 5) = f.Offset(, 1).Value   'TOOL USED
              
        End If
        Set f = r.FindNext(f)
      Loop While Not f Is Nothing And f.Address <> cell
      TextBox1 = UCase(TextBox1)
      .TopIndex = 0
      Else
      MsgBox "NO ITEM WAS FOUND USING THAT INFORMATION", vbCritical, "LOCK PICK ME ITEM SEARCH"
      TextBox1.Value = ""
      TextBox1.SetFocus
    End If
  End With
End Sub
 

Attachments

  • 7087.jpg
    7087.jpg
    182 KB · Views: 5

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Typical just found it.
Columns were at 6 & needed to be 7
Once done i changed the number to match row & bingo

Thanks
 
Upvote 0

Forum statistics

Threads
1,214,875
Messages
6,122,044
Members
449,063
Latest member
ak94

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