Vba doesnt match list on userform

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
3,721
Office Version
  1. 2007
Platform
  1. Windows
Hi,
I have a drop down list on my userform where ive just added a new column to sort.
This column being LEAD TYPE in column K
I have changed the rows from 8 to 11 so i dont have to scroll on the userform BUT i only see 10 options & not 11 ?
Looking at the code in use doesnt match what the userform drop down list shows ?

As you can see LEAD TYPE 1 reads LEAD where LEAD TYPE 2 isnt even shown at all.

VBA Code:
Private Sub CommandButton1_Click()
Dim x As Long
Dim ws As Worksheet
Set ws = Sheets("MC LIST")
Dim SortColumn As String

Select Case ComboBox1
Case "CUSTOMER"
SortColumn = "A"

Case "VIN"
SortColumn = "B"

Case "MAKE"
SortColumn = "C"

Case "MODEL"
SortColumn = "D"

Case "ITEM BOUGHT"
SortColumn = "E"

Case "CHIP"
SortColumn = "F"

Case "COUNTRY"
SortColumn = "G"

Case "ORIGINAL PN"
SortColumn = "H"

Case "YEAR"
SortColumn = "I"

Case "LEAD TYPE 1"
SortColumn = "J"

Case "LEAD TYPE 2"
SortColumn = "K"

End Select
If Len(SortColumn) <> 0 Then
Application.ScreenUpdating = False
With ws
If .AutoFilterMode Then .AutoFilterMode = False
x = .Cells(.Rows.Count, 1).End(xlUp).Row
.Range("A7:K" & x).Sort Key1:=.Cells(2, SortColumn), Order1:=xlAscending, Header:=xlGuess
End With
End If
Unload AtoZMcList
End Sub
 

Attachments

  • 6927.jpg
    6927.jpg
    75.2 KB · Views: 3

Some videos you may like

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
3,721
Office Version
  1. 2007
Platform
  1. Windows
Ive found that the names in the drop down list are from the worksheet headers & not the names in the code.
So where does the drop down list omit column K thus not showing up ?
 

Watch MrExcel Video

Forum statistics

Threads
1,114,651
Messages
5,549,204
Members
410,905
Latest member
Extjel
Top