PC Review


Reply
Thread Tools Rate Thread

Data Validation Dropdown bug

 
 
Charlie
Guest
Posts: n/a
 
      20th Feb 2008
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.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Data Series Selection from Data Validation Dropdown? Kris S Microsoft Excel Charting 1 23rd May 2008 11:17 PM
Data Validation Dropdown jliu2000 Microsoft Excel Misc 1 13th Oct 2004 10:11 PM
Data Validation Dropdown jliu2000 Microsoft Excel Misc 3 12th Oct 2004 09:44 PM
Data Validation Dropdown jliu2000 Microsoft Excel Misc 2 12th Oct 2004 06:32 PM
Data Validation Dropdown jliu2000 Microsoft Excel Misc 1 12th Oct 2004 03:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:34 AM.