Advice for userform to sort then go to.....

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,226
Office Version
  1. 2007
Platform
  1. Windows
Hi,
On my worksheet in column B i have a list of vehicles.
These vechiles at present are unsorted because column D is in the A-Z sort option.

Imagine the vehicles are.
ACCORD
CIVIC
INSIGHT
JAZZ
ETC ETC & there are many instances of the same car.
So when column B is sorted A-Z so ACCORD has 55 rows followed by CIVIC with 104 rows etce etc.

I need to make a userform which each model of vehicle in the list so when i click say INSIGHT i would like to be taken to the first instance of INSIGHT
Currently im scrolling through lots of rows before i even get to the I section.
 
Post the code for the command button. Is the combobox named "ComboBox1"?
 
Upvote 0

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
My code in post #2 works fine.

If i can then go to first instance of combobox1 selection after the sort is done thats all
 
Upvote 0
Yep that works but my code still fails.

CommandButton1 code is
Rich (BB code):
Private Sub CommandButton1_Click()
HondaListSortAndGoToVehicle.Show
End Sub

So the userform HondaListSortAndGoToVehicle code is,
Rich (BB code):
Private Sub ComboBox1_Change()
    Dim fnd As Range
    Set fnd = Sheets("HONDA LIST").Range("B:B").Find(ComboBox1.Value, LookIn:=xlValues, lookat:=xlWhole)
    fnd.Select
    Unload Me
End Sub

Private Sub UserForm_Initialize()
    Application.ScreenUpdating = False
    Dim Rng As Range, RngList As Object, WS As Worksheet
    Set WS = ThisWorkbook.Sheets("HONDA LIST")
    WS.Cells(1, 2).Sort Key1:=Columns(2), Order1:=xlAscending, Orientation:=xlTopToBottom, Header:=xlYes
    Set RngList = CreateObject("Scripting.Dictionary")
    For Each Rng In WS.Range("B4", WS.Range("B" & WS.Rows.Count).End(xlUp))
        If Not RngList.Exists(Rng.Value) Then
            RngList.Add Rng.Value, Nothing
            ComboBox1.AddItem Rng
        End If
    Next
End Sub

Userform screenshot shown
 

Attachments

  • 7181.jpg
    7181.jpg
    157.2 KB · Views: 4
Upvote 0
Could you upload a copy of your file to a free site such as www.box.com or www.dropbox.com? Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here.
 
Upvote 0
Just doing that now.

I can tell you that when i click the command button now i see the userform,i make a selection but i am not taken to it.



I say this as a slimmed done version does something the full version doesnt if that make sense
 
Upvote 0
Can you de-sensitize the data?
 
Upvote 0
I have many other sheets on the same workbook,last time made anerror & took ages to find it
 
Upvote 0
Just include the "HONDA LIST" sheet (de-sensitized) and delete the others.
 
Upvote 0

Forum statistics

Threads
1,214,975
Messages
6,122,537
Members
449,088
Latest member
RandomExceller01

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