Combo Box Issue

nparsons75

Well-known Member
Joined
Sep 23, 2013
Messages
1,254
Office Version
  1. 2016
I have a combobox on a userform that gets its data from a closed spreadsheet. The main isssue is that a serial number is typed into a form that send it to a database. From the database the combobox picks up the serial number. Once the operation has been complete I need it to no longer show in the combobox but I cannot delete it from the database it it is always needed in there. Does anyone know of a workaround? appreciate any help.
 
But not this one:
Code:
 If Item.Offset(0, 9).Value <> "PASS" Then

It returns all the data in column F5. It just does not seem to filter out any data that does not match "PASS".

In column 9 the data is equal to either "PASS" or "FAIL".

Offset 9 returns Column 10.

Try:

Code:
If Item.Offset(0, 8).Value <> "PASS" Then

Dave
 
Upvote 0

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Have you managed to look at the files? I will try this out shortly. Fingers crossed. I will let you know how it goes. I tried all different rows but made no difference, I am hoping I didn't try this one. Hope your tooth is OK. Sorry to be an additional pain.
 
Upvote 0
Tried it, still the same. Still shows all numbers in column F.

Code:
Set rng = .Range(.Range("F5"), .Range("F" & .Rows.Count).End(xlUp))

Tried this:

Code:
For Each Item In rng            If Item.Offset(0, [B]8[/B]).Value <> "PASS" Then
                .AddItem Item.Value    ' populate the listbox
            End If

All values in column F are returned, the ones with "FAIL" still show?

Did you manage to run the files?
 
Upvote 0
The logic of the test is to additem if the value does not equal PASS. As FAIL does not equal PASS it will be added. You need to update your test to ensure only correct values are returned.

Dave
 
Upvote 0
I have tested as follows. At stage 1 and 2 I have added data. Serial number 1 and 2. Number 1 is set to pass. Number 2 is set to fail. At stage 3 only number 1 should be visible to select. As it is, both 1 and 2 are present.
 
Upvote 0
Just reading this again, I need the item to be added at the next stage if the value DOES equal PASS. A fail can go no further, PASS means it can proceed to the next stage. Is that the issue? Having said that I have tried both scenarios, and neither is working. I have no nails left....
 
Upvote 0
does it matter that i have a combobox and not a listbox? I really cant believe this won't work, it all looks perfect.
 
Upvote 0
does it matter that i have a combobox and not a listbox? I really cant believe this won't work, it all looks perfect.

It should make no difference which you are using - you just need to work through the logical test (e.g Offset(0,8).Value <>"FAIL") in your For next Loop with each userform to ensure that only the required data populates the combobox.
 
Upvote 0
Hi,

I have no hair left, I have pulled it all out......

I have tried the testing, changing the Offset(0,8).Value <>"FAIL" has no effect.

It seems to set the range above and then ignore this offset.

 
Upvote 0
Code will work if you have your logical test & offset correct.

I think with paint stage 3 try:

Code:
         For Each Item In rng
            If Item.Offset(0, 3).Value <> "PASS" Then
                .AddItem Item.Value    ' populate the listbox
            End If

This adds everything that is not equal to Ucase PASS

Backpress Stage

Code:
          For Each Item In rng
            If Item.Offset(0, 3).Value <> "AVAILABLE" Then
                .AddItem Item.Value    ' populate the listbox
            End If
            Next Item


This adds everything that is not equal to Ucase AVAILABLE.
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,684
Members
449,116
Latest member
HypnoFant

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