Widen Data Validation Dropdown

D

Darren Hill

I use Chip Pearson' very nifty WidenNameBox macro to resize the name box for
viewing longer defined names. Is it possible to modify this macro to work
with the Data Validation drop down?
It's frustrating at be limited to the width of the cell (which in my current
sheet is only 24 points), and using comboboxes wouldn't be ideal as I have
over 6000 rows and 5 columns which contain dropdowns.

The original macro is below.
Yours in possibly futile hope, Darren
--------------------------
The macro is:

Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
(ByVal hWnd1 As Long, ByVal hWnd2 As Long, _
ByVal lpsz1 As String, ByVal lpsz2 As String) As Long

Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, lParam As Any) As Long


Sub WidenNameBoxDrop2()

Dim Res As Long
Const CB_SETDROPPEDWIDTH = &H160
Const cWidth = 300 '<<<<<<<<<<<<<<<<<<<<<<
Res = SendMessage( _
FindWindowEx( _
FindWindowEx( _
FindWindow("XLMAIN", Application.Caption) _
, 0, "EXCEL;", vbNullString) _
, 0, "combobox", vbNullString), _
CB_SETDROPPEDWIDTH, cWidth, 0)

End Sub
 

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