Combo box not updating

dpaton05

Well-known Member
Joined
Aug 14, 2018
Messages
2,352
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I enter names on my sheet called Tracker and press a button, add name. This adds it to the named range called tblYPNames that is stored on the sheet, YPNames. I have 2 combo boxes on Tracker with the listFillRange being tblYPNames for both of them but I add names using the initial method and the combo boxes do not get updated with the new names. I have checked and the named range is updated with the new names but the names still don't appear in the combo boxes.

Can someone help me please?


I am updating this post to say that if I save and close the file then reopen it, the combo boxes are updated but I want an automatic update to occur.
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Make sure the combo box slider is in the correct position.....sometimes it defaults to the bottom of the list !!
AND
What have you changed since it DID work previously.
 
Upvote 0
There is only 2 items in the list so there is no need for a slider. The previous version had the same problem, I just didn't realise since I was working on something else. The version before that works but I have changed so many things since that time and I can't remember what I have changed.
 
Upvote 0
It is really strange as sometimes the combobox updates and sometimes it doesn't. I have no idea why though. :unsure:
 
Upvote 0
In previous threads you were looking for a delete name code......Is it possible you have called the wrong code when adding a newYP??
 
Upvote 0
Are you using V2.1 ?....works fine for me!
 
Upvote 0
I am up to v2.6 now. It is really strange as sometimes it updates and sometimes it doesn't.
 
Upvote 0
I have found a post that says you need to tell the list fill range of the combo box to be the named range again after updating the named range. I did that and it seems to have fixed it. Thanks anyway Michael. All I did was add the last line to redefine the named range

VBA Code:
Sub AddYP()
Application.DisplayAlerts = False
Dim newyp As String
    newyp = Tracker.Cells(5, 4)
    YP.Range("A" & Rows.Count).End(xlUp).Offset(1, 0) = newyp
    Call CreateWB(newyp)
Application.DisplayAlerts = True
    ThisWorkbook.Names.Add Name:="tblYPNames", _
    RefersTo:=Range("tblYPNames").Resize(Range("tblYPNames").Rows.Count + 1)
    Tracker.cboYP.ListFillRange = "tblYPNames"
End Sub
 
Upvote 0
If you are reffering to this part of the code.....It's what I gave you last Friday !!!
VBA Code:
ThisWorkbook.Names.Add Name:="tblYPNames", _
    RefersTo:=Range("tblYPNames").Resize(Range("tblYPNames").Rows.Count + 1)
    Tracker.cboYP.ListFillRange = "tblYPNames"
 
Upvote 0
No, the very last line is what I added
VBA Code:
Tracker.cboYP.ListFillRange = "tblYPNames"
 
Upvote 0

Forum statistics

Threads
1,215,025
Messages
6,122,732
Members
449,093
Latest member
Mnur

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