View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Data validation: wider window on 14 columns

Maybe something like:

Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Dim myRng As Range

If Target.Count 1 Then Exit Sub

'adjust the range to what you want
Set myRng = Me.Range("a:b,x:y,d1:d5")

'fix all the columns
myRng.EntireColumn.ColumnWidth = 5

If Intersect(Target, myRng) Is Nothing Then
'do nothing
Else
'adjust that single column
Target.EntireColumn.ColumnWidth = 10
End If
End Sub




Jim C wrote:

I need 14 columns to temporarily expand so a data validation window can be
read.

Can the following solution from
http://www.contextures.on.ca/xlDataVal08.html#Wider be used on multiple
columns?

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
If Target.Column = 37 Then
Target.Columns.ColumnWidth = 10
Else
Columns(37).ColumnWidth = 5
End If
End Sub

--
Thanks
Jim C


--

Dave Peterson