create controls on a form for the value of a named range?

jinx_uk_98

Board Regular
Joined
Jul 3, 2005
Messages
105
Hi all,

I have a named range of cells that is added to and deleted from over time.

Is these any code that will create a label for every item in that named range and rename it's caption?

Thanks in advance
Kev
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Hi jinx_uk_98,

I'm wondering if there is an upper limit to the number of cells that the named range can be sized to include. If not, this presents somewhat of a problem for the design of the form--making it automatically size arbitrarily large.

But if there is some reasonable upper limit, then I would recommend that you design the form with this upper limit of Labels pre-sized and pre-positioned on it--then making the unused labels (that are in excess of the number needed) invisible by setting their Visible properties to False. This is a lot simpler than adding new labels to (or deleting old from) the form at run time.

The best way to loop through all the cells in the range and set the Visible properties and Captions of the labels depends upon the characteristics of the named range. For example, if the range has a fixed number of columns but a variable number of rows this might suggest simply using the number of rows in the range to calculate the range of Label numbers that would need to be set.

I hope this helps.

Damon
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,843
Members
449,051
Latest member
excelquestion515

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