ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Refresh a Combobox (https://www.excelbanter.com/excel-programming/438654-refresh-combobox.html)

QB

Refresh a Combobox
 
I have a cbo which is linked to a named ranged on another sheet.

Using code, the named range gets deleted and the recreated, but the cbo does
not update it list of items to reflect the new named range content. How can
I refresh its list?

QB

QB

Refresh a Combobox
 
If I close the workbook and reopen it, it refreshes the item list properly?!
So why doesn't it adjust when I redefine the named range using vba?

QB





"QB" wrote:

I have a cbo which is linked to a named ranged on another sheet.

Using code, the named range gets deleted and the recreated, but the cbo does
not update it list of items to reflect the new named range content. How can
I refresh its list?

QB


michdenis

Refresh a Combobox
 
Hi,

And this :
'----------------------------
With Worksheets("Sheet1")
'Redefine your name
.Range("b1:b75").Name = "toto"
'You add this line
.OLEObjects("ComboBox1").ListFillRange = "toto"
End With
'----------------------------



"QB" a écrit dans le message de groupe de discussion :
...
I have a cbo which is linked to a named ranged on another sheet.

Using code, the named range gets deleted and the recreated, but the cbo does
not update it list of items to reflect the new named range content. How can
I refresh its list?

QB


Jim Thomlinson

Refresh a Combobox
 
Use the gotfocus method to repopulate

Private Sub ComboBox1_GotFocus()
ComboBox1.ListFillRange = Application.Names("Stuff").RefersToRange.Address
End Sub
--
HTH...

Jim Thomlinson


"QB" wrote:

If I close the workbook and reopen it, it refreshes the item list properly?!
So why doesn't it adjust when I redefine the named range using vba?

QB





"QB" wrote:

I have a cbo which is linked to a named ranged on another sheet.

Using code, the named range gets deleted and the recreated, but the cbo does
not update it list of items to reflect the new named range content. How can
I refresh its list?

QB


Chip Pearson

Refresh a Combobox
 
Are you using the combobox from the Forms commandbar or from the
Controls commandbar? Also, what exactly are you deleting? Are clearing
the values within the named Range (e.g.,
Range("TheList").ClearContents), or are you deleting the cells
referenced by the name (e.g., Range("TheList").Delete) or are you
deleting the name itself (e.g.,
ThisWorkbook.Names("TheList").Delete)???

Cordially,
Chip Pearson
Microsoft MVP 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
[email on web site]



On Wed, 20 Jan 2010 12:45:01 -0800, QB
wrote:

I have a cbo which is linked to a named ranged on another sheet.

Using code, the named range gets deleted and the recreated, but the cbo does
not update it list of items to reflect the new named range content. How can
I refresh its list?

QB



All times are GMT +1. The time now is 12:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com