Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1005
How to find selection ranges
posted

Hi,

I would like to display a text box showing the currently selected cells in a grid as an Excel like string, e.g. Sheet1!A1:B2.

I can format the string ok, but my problem is that the grid's 'Selected' property only returns a list of individual cells, rows, and columns, but not the ranges!

It seems likely that these will be stored internally as a list of selection ranges (perhaps as a topleft and bottomright pair of points), if so, is there any way to get at the actual ranges?  If this is not possible can you suggest the best way to work out the ranges from the selection object?  For example, if the cells collection (and rows and columns for that matter) is ordered in any particular way then that would help. :)

Thanks.

Brian