ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Determine shape name associated with a specific cell (https://www.excelbanter.com/excel-discussion-misc-queries/25678-determine-shape-name-associated-specific-cell.html)

[email protected]

Determine shape name associated with a specific cell
 
Yesterday I made changes to some code I found on the net: the code
resizes the visible width of a validation dropdown list. The code I
found refers to a very specific dropdown: the shape name specified is
"Drop Down 1".

Isn't it likely, or at least possible, that there may be "Drop Down
1" thru "Drop Down n" within the same spreadsheet? Is there code
to determine the shape name associated with a particular cell? The
code I have is

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
{delete to save space}
If Target.Validation.Type = xlValidateList Then
etc.
End Sub

Is there a variation on Target.Validation.Type that will tell me the
shape name for this cell? Something like Target.Shapes.Name...?

Thanks


Dave Peterson

It looks like your mixing up dropdowns from the Forms toolbar with
Data|Validation.

If it's really Data|Validation, you may want to look at how Debra Dalgleish
approaches it:
http://www.contextures.com/xlDataVal08.html#Larger


wrote:

Yesterday I made changes to some code I found on the net: the code
resizes the visible width of a validation dropdown list. The code I
found refers to a very specific dropdown: the shape name specified is
"Drop Down 1".

Isn't it likely, or at least possible, that there may be "Drop Down
1" thru "Drop Down n" within the same spreadsheet? Is there code
to determine the shape name associated with a particular cell? The
code I have is

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
{delete to save space}
If Target.Validation.Type = xlValidateList Then
etc.
End Sub

Is there a variation on Target.Validation.Type that will tell me the
shape name for this cell? Something like Target.Shapes.Name...?

Thanks


--

Dave Peterson


All times are GMT +1. The time now is 11:55 AM.

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