ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Data validation: wider window on 14 columns (https://www.excelbanter.com/excel-discussion-misc-queries/156090-data-validation-wider-window-14-columns.html)

Jim C

Data validation: wider window on 14 columns
 
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

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

Jim C

Data validation: wider window on 14 columns
 
It worked great! Is there any way to eliminate the "blinking" in the
worksheet as the cursor moves to another cell?
--
Jim C


"Dave Peterson" wrote:

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


Dave Peterson

Data validation: wider window on 14 columns
 
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")

application.screenupdating = false '<-- added

'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

application.screenupdating = True '<-- added

End Sub

Jim C wrote:

It worked great! Is there any way to eliminate the "blinking" in the
worksheet as the cursor moves to another cell?
--
Jim C

"Dave Peterson" wrote:

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


--

Dave Peterson


All times are GMT +1. The time now is 04:13 AM.

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