Problem with combo box

rjc4

Well-known Member
Joined
Nov 6, 2004
Messages
502
Hi All,

The code below is causing incorrect data to be extracted. Can anyone help to solve, please.

Option Explicit
Private Sub ComboBox4_Change()
With Me.ComboBox4
If .ListIndex > -1 Then
Me.Cells(11, "G") = .Value
Me.Cells(11, "H") = Val(.List(.ListIndex, 1))
End If
End With
End Sub

My combo box range is U26:V150.
My input cells are G and H.
G contains a two letter alpha entry.
H contains 1 or 2 digits.

In my database U26:V150 is:-
RA 4
RA 6
RP 4
RP 5

Problem:
When I choose say RA 6 from the dropdown box, the number in H reverts back to 4.
If I choose say RP 5 the number also reverts back to 4.

The alpha code is always inserted correctly but the number goes to the first number entry which is 4.

It looks like it gets confused by duplicates. When I don’t have duplicates it behaves normally and correctly. Could anyone suggest a solution to fix this annoying problem.

Thanks
RC
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

Forum statistics

Threads
1,215,511
Messages
6,125,250
Members
449,218
Latest member
daynle

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