LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Data Validation Dropdown bug

Several weeks ago I posted a problem with my data validation dropdown lists
becoming much wider than the column they were attached to. They appeared to
be picking up the width of the wrong column. After weeks of trying to
determine the cause (in my spare time, of course) I was finally able to
reproduce the error and come up with a work-around.

I use several controls on my sheets to unprotect them, unlock cells, attach
data validation, re-protect the sheet, etc. in an effort to "guide" my users
into correct data entry. (If there's a way to enter garbage, there's a user
who will find it.) In other words, I create and delete data validation cells
on the fly.

I discovered that once I've created the DV cells, if the user clicks in a DV
cell of a wide column (even if the user does not select from that list) it
sets the width of the dropdown! Clicking in a wider DV cell after the first
DV cell works fine, but clicking in a narrower DV cell shows the list at the
same width as the first DV cell. It's really annoying when the first cell is
half a page wide and the next one is only a few characters wide!

My work-around, even though "Kludgey", is to pre-set the DV dropdown width
using a narrow "phantom" cell when the user clicks the control to unlock the
sheet. I save the active cell postion, then add DV to a narrow cell,
activate that cell, delete the DV, then re-activate the original cell. I
scan across row 1 for the narrowest column width. Here's a snippet:

iRow = ActiveCell.Row
iCol = ActiveCell.Column
Cells(1, iSmallestCol).Validation.Add _
Type:=xlValidateList, _
AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, _
Formula1:="=A2"
Cells(1, iSmallestCol).Activate
Cells(1, iSmallestCol).Validation.Delete
Cells(iRow, iCol).Activate

It's stupid to have to do this but I couldn't figure out another way. There
is no DV Dropdown width property to set as far as I can tell.

 
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
how to write in a dropdown data(Validation) [email protected] Excel Discussion (Misc queries) 2 January 3rd 10 02:41 PM
Data validation with dropdown list geotso Excel Discussion (Misc queries) 2 February 1st 09 05:59 PM
Dropdown lists from datavalidation. MichaelZ Excel Discussion (Misc queries) 3 October 21st 08 02:31 PM
Data Validation Calender Dropdown andyp161[_3_] Excel Programming 1 September 7th 04 10:14 PM
Widen Data Validation Dropdown Darren Hill[_2_] Excel Programming 4 December 7th 03 08:52 PM


All times are GMT +1. The time now is 05:10 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"