ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Widening Validation Box (https://www.excelbanter.com/excel-worksheet-functions/51656-widening-validation-box.html)

Alex Mackenzie

Widening Validation Box
 
I have found an earlier reference on how to temporarily widen a validation
box using target.columns.columnwidth. Is there a way I can do this ONLY when
a specific validation box is being used, i.e. I do not want to temporarily
widen the column every time a cell is active, only one or two cells. Thank
you

Bob Phillips

Widening Validation Box
 
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With Target
If .Count 1 Then Exit Sub
If .Address = "$B$5" Or .Address = "$H$8" Then
.Columns.ColumnWidth = 20
Else
Columns(2).ColumnWidth = 5
Columns(8).ColumnWidth = 5
End If
End With
End Sub


'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Alex Mackenzie" wrote in message
...
I have found an earlier reference on how to temporarily widen a validation
box using target.columns.columnwidth. Is there a way I can do this ONLY

when
a specific validation box is being used, i.e. I do not want to temporarily
widen the column every time a cell is active, only one or two cells.

Thank
you





All times are GMT +1. The time now is 01:02 AM.

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