Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 7
Post Dropdown list width changing code

I got the the following code from contextures.com, but it's not satisfying. Is there a way to change it so that it will work on a given range of cells with dropdown list so that any cell in the range, say "A1:Z1" will temporarily widen when selected?

Here's the code they gave:

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

---
Thanks
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gord Dibben
 
Posts: n/a
Default Dropdown list width changing code

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column 26 Then Exit Sub
If Not Application.Intersect(Range("a1:z1"), _
Target) Is Nothing Then
Target.Columns.ColumnWidth = 20
Else
Target.Columns.ColumnWidth = 5
End If
End Sub


Gord Dibben MS Excel MVP

On Mon, 26 Jun 2006 17:50:40 +0100, XXL User
wrote:


I got the the following code from contextures.com, but it's not
satisfying. Is there a way to change it so that it will work on a given
range of cells with dropdown list so that any cell in the range, say
"A1:Z1" will temporarily widen when selected?

Here's the code they gave:

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

---
Thanks


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dropdown list key selection TrevorM Excel Discussion (Misc queries) 1 October 3rd 05 07:57 PM
Change case...help please Terry Excel Worksheet Functions 14 October 2nd 05 12:29 PM
How do I change the width of the data validation list box? Davy Lawson Excel Discussion (Misc queries) 2 August 18th 05 03:11 AM
Macro for changing text to Proper Case JPriest Excel Worksheet Functions 3 August 8th 05 09:31 PM
Make Change Case in Excel a format rather than formula Kevin Excel Worksheet Functions 1 March 18th 05 08:53 PM


All times are GMT +1. The time now is 08:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"