Validation List Width

CanWestBoss

New Member
Joined
Jun 21, 2012
Messages
1
I am trying to make the width of a validation list wider without widening the column width. My Validation list pull downs are in cells D7:D65536 and my list is on another sheet in a named range called ProdList

I have tried the following code i found here on these forums but with no luck. I am getting desparate as I have to have this finished by tomorrow. If anyone could assist that would be greatly appreciated

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim myShp As Shape, Drp As Single
On Error Resume Next
'cells holding drop downs
If Intersect(Target, [d7:d65536]) Is Nothing Then Exit Sub
If Target.Validation.Type = xlValidateList Then
    Set myShp = ActiveSheet.Shapes("Drop Down 1")
    Drp = myShp.Width - Target.Width
    'Column holding list, sized appropriately
    myShp.Width = ["ProdList].Width
    myShp.Left = Target.Left - myShp.Width / 2 + Drp * 2
End If
Set myShp = Nothing
End Sub
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Hi and welcome to the Board
I'm not sure about later versions, but up to 2003, you either have to widen the column where the list of data is referenced from or use VBA.
This will temporarily (while the column is the active column), widen the column.
Once the focus has moved to another column, the target column will revert back to the smaller size
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  If Target.Count > 1 Then Exit Sub
   If Target.Column = 4 Then 'assuming the data list is in column "D"
       Target.Columns.ColumnWidth = 20
   Else
       Columns(4).ColumnWidth = 12
   End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,211,772
Messages
6,103,881
Members
447,883
Latest member
bennazi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top