#1   Report Post  
gavin
 
Posts: n/a
Default Data validation

I am using Data Validation to restrict entry into a cell to the items in a
list and I have two questions.

Firstly, can I adjust the width of the drop down box which appears when I
click on the arrow in the cell? The items in the list are only a few
characters and the box is much wider - I just want to "tidy" this up a bit.

Secondly is there a way of making the list drop down automatically when the
cell has the focus rather than having to click on the arrow - this would
just speed up the date entry as I have a number of columns with Data
Validation on the sheet?


Many thanks for any help with these,



Gavin


  #2   Report Post  
Bob Umlas
 
Posts: n/a
Default

Firstly, no
Secondly: Right-click the sheet tab, select View Code, enter:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim tf As Boolean
On Error Resume Next
tf = Target.Resize(1, 1).Validation.InCellDropdown
If Err.Number < 0 Then Exit Sub
If tf Then
SendKeys "%{down}"
End If
End Sub

"gavin" wrote in message
...
I am using Data Validation to restrict entry into a cell to the items in a
list and I have two questions.

Firstly, can I adjust the width of the drop down box which appears when I
click on the arrow in the cell? The items in the list are only a few
characters and the box is much wider - I just want to "tidy" this up a

bit.

Secondly is there a way of making the list drop down automatically when

the
cell has the focus rather than having to click on the arrow - this would
just speed up the date entry as I have a number of columns with Data
Validation on the sheet?


Many thanks for any help with these,



Gavin




  #3   Report Post  
gavin
 
Posts: n/a
Default

Shame about the first one :-)

But the second one is brilliant!!!


Thanks so much for your help, Bob - it's much appreciated.


Regards,


Gavin


"Bob Umlas" wrote in message
...
Firstly, no
Secondly: Right-click the sheet tab, select View Code, enter:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim tf As Boolean
On Error Resume Next
tf = Target.Resize(1, 1).Validation.InCellDropdown
If Err.Number < 0 Then Exit Sub
If tf Then
SendKeys "%{down}"
End If
End Sub

"gavin" wrote in message
...
I am using Data Validation to restrict entry into a cell to the items in

a
list and I have two questions.

Firstly, can I adjust the width of the drop down box which appears when

I
click on the arrow in the cell? The items in the list are only a few
characters and the box is much wider - I just want to "tidy" this up a

bit.

Secondly is there a way of making the list drop down automatically when

the
cell has the focus rather than having to click on the arrow - this would
just speed up the date entry as I have a number of columns with Data
Validation on the sheet?


Many thanks for any help with these,



Gavin






  #4   Report Post  
gavin
 
Posts: n/a
Default

Although this works perfectly I wondered if the code to be tweaked to
account for the occasions when a user opens the workbook with a cell with
Data Validation already having the focus - in which case the drop down
doesn't work. In other words this code only seems to work when a cell gains
the focus.


Regards,



Gavin




"Bob Umlas" wrote in message
...
Firstly, no
Secondly: Right-click the sheet tab, select View Code, enter:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim tf As Boolean
On Error Resume Next
tf = Target.Resize(1, 1).Validation.InCellDropdown
If Err.Number < 0 Then Exit Sub
If tf Then
SendKeys "%{down}"
End If
End Sub

"gavin" wrote in message
...
I am using Data Validation to restrict entry into a cell to the items in

a
list and I have two questions.

Firstly, can I adjust the width of the drop down box which appears when

I
click on the arrow in the cell? The items in the list are only a few
characters and the box is much wider - I just want to "tidy" this up a

bit.

Secondly is there a way of making the list drop down automatically when

the
cell has the focus rather than having to click on the arrow - this would
just speed up the date entry as I have a number of columns with Data
Validation on the sheet?


Many thanks for any help with these,



Gavin






  #5   Report Post  
Dave Peterson
 
Posts: n/a
Default

Maybe you could select an out of the way cell on that sheet when you open the
workbook:

Option Explicit
Private Sub Workbook_Open()

Dim CurWks As Worksheet
Set CurWks = ActiveSheet

With Application
.EnableEvents = False
.ScreenUpdating = False
.Goto Worksheets("sheet1").Cells _
.SpecialCells(xlCellTypeLastCell).Offset(1, 1)
CurWks.Select
.ScreenUpdating = True
.EnableEvents = True
End With
End Sub

Now the user has to select the cell to start it off. And Bob's event will fire.

gavin wrote:

Although this works perfectly I wondered if the code to be tweaked to
account for the occasions when a user opens the workbook with a cell with
Data Validation already having the focus - in which case the drop down
doesn't work. In other words this code only seems to work when a cell gains
the focus.

Regards,

Gavin

"Bob Umlas" wrote in message
...
Firstly, no
Secondly: Right-click the sheet tab, select View Code, enter:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim tf As Boolean
On Error Resume Next
tf = Target.Resize(1, 1).Validation.InCellDropdown
If Err.Number < 0 Then Exit Sub
If tf Then
SendKeys "%{down}"
End If
End Sub

"gavin" wrote in message
...
I am using Data Validation to restrict entry into a cell to the items in

a
list and I have two questions.

Firstly, can I adjust the width of the drop down box which appears when

I
click on the arrow in the cell? The items in the list are only a few
characters and the box is much wider - I just want to "tidy" this up a

bit.

Secondly is there a way of making the list drop down automatically when

the
cell has the focus rather than having to click on the arrow - this would
just speed up the date entry as I have a number of columns with Data
Validation on the sheet?


Many thanks for any help with these,



Gavin





--

Dave Peterson
Reply
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
Data validation mac Excel Worksheet Functions 2 January 31st 05 07:20 PM
Pulling data from 1 sheet to another Dave1155 Excel Worksheet Functions 1 January 12th 05 05:55 PM
Using Validation List from Another Workbook with Dependent Data Mike R. Excel Worksheet Functions 5 January 8th 05 07:06 PM
Data Validation Mike Excel Worksheet Functions 1 November 29th 04 07:01 PM
Data Validation Formula Help Steve H. Excel Worksheet Functions 2 November 11th 04 09:38 PM


All times are GMT +1. The time now is 06:37 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"