ActiveX Combobox.matchentry not working for last item in dropdown list

MoshiM

Active Member
Joined
Jan 31, 2018
Messages
439
Office Version
  1. 2016
Platform
  1. Windows
I have a combobox that is populated with al the worksheet names sorted in alphabetical order when the workbook is opened. When a user types in the name of a worksheet(partial match) then they are taken to that sheet. However this doesn't work for the last sheet in the list. Adding another sheet that would appear below this sheet alphabetically results in the user not being brought to the sheet but the previous sheet now works correctly.

Code:
Private Sub Sheet_Selection_Click()

    Application.Run "'" & ThisWorkbook.Name & "'!Go_To_Sheet", Me.Sheet_Selection.Value

End Sub
Code:
Private Sub Go_To_Sheet(Combo_Object_Value As String)
On Error Resume Next
Application.ScreenUpdating = False
ActiveWorkbook.Worksheets(Combo_Object_Value).Activate
Application.ScreenUpdating = True
End Sub
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Can't see where your problem comes from - bit of an odd one, that...
However... wouldn't it be a lot simpler to just put the worksheet_activate call, directly into the ComboBox's _click event?
Code:
Private Sub ComboBox1_Change()
Sheets(Me.ComboBox1.Value).Activate
End Sub
...or, in your case:
Code:
Private Sub Sheet_Selection_Click_Change()
Sheets(Me.Sheet_Selection_Click.Value).Activate
End Sub
- cut out the middle man, so to speak...
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,219
Members
452,619
Latest member
Shiv1198

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