Help with Macro - Make Dropdown List Temporarily Wider

A

AK9955

Sorry I'm not a Programmer, so would appreciate your help with the following
macro I pulled from the contextures.com site (thanks to Bob).

Using below macro I was able to make ONE dropdown list temporarily wider.
Hooray. However, when I tried to make another dropdown list (within same
worksheet) temporarily wider, I was at a loss as to how to edit the code.
Tried & tried and I'm tired! Can someone edit below macro to include ANOTHER
DROPDOWN LIST (i.e. column) so I can figure out how its done.

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 so much, Anna.
 
G

Gary''s Student

The key is the fourth line. The code looks for column #4 (column D ). Lets
say we want the code to work on both column D and column J. Instead of:

If Target.Column = 4 Then

use:

If Target.Column = 4 OR Target.Column = 10 Then
 
A

AK9955

Thanks Gary, I understand what your saying. However, what if I want the
column widths to be different for my lists? I wouldn't use an OR statement,
would I?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top