Vba doesnt match list on userform

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,226
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: 6

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
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 ?
 
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,602
Members
449,089
Latest member
Motoracer88

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