Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default using VBA to emulate "validation" drop-down list

I like the Excel data validation tool, but it is lost if the user does a paste of a range of cells. Is there a way to emultate this function in VBA. If I use a form to do it, the form will steal the focus and the user can only work on one cell at a time. BTW this is for 2000 version of the program
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default using VBA to emulate "validation" drop-down list

You could always re-create the DV when a user selects teh cell

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("C1:C10")) Is Nothing Then
With Target
With .Validation
.Delete
.Add Type:=xlValidateList, _
AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, _
Formula1:="=A1:A10"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.



--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Donager Dave" wrote in message
...
I like the Excel data validation tool, but it is lost if the user does a

paste of a range of cells. Is there a way to emultate this function in VBA.
If I use a form to do it, the form will steal the focus and the user can
only work on one cell at a time. BTW this is for 2000 version of the
program


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
Validation ?:Accepting both Numbers AND specific letters("N","n"," Antonio Excel Discussion (Misc queries) 2 April 22nd 08 05:07 PM
Data Validation "List" - Setting length of list shown Dave Excel Discussion (Misc queries) 3 January 31st 08 06:51 PM
Can I include a "validation drop down" in a conditional statement? JanW Excel Worksheet Functions 1 June 5th 07 08:50 PM
how do i enable a drop down list depending on result of "if" funct Varun Excel Worksheet Functions 3 August 8th 06 04:44 PM
Make typing "jump" to matching item(s) in drop-down list? Kathy Excel Discussion (Misc queries) 4 November 22nd 05 10:25 PM


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