Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 202
Default Select from a List

I have a dropdown list of Days set in a named range. Is it possible to
set a condition that you can only select a day that is <= to Today? -
all via Data Validation
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15
Default Select from a List

Assuming A2 is the validated cell, use Custom validation with the
formula

=(COUNTIF(daterange,A2)<0)*(A2<=TODAY())

daterange is the range of excel cells that contain admissible dates.

HTH
Kostis Vezerides

On 20 Ιαν, 11:25, Seanie wrote:
I have a dropdown list of Days set in a named range. Is it possible to
set a condition that you can only select a day that is <= to Today? -
all via Data Validation


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 202
Default Select from a List

Thanks, but is it possible to do with a Drop Down list in A2?

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15
Default Select from a List

Not if you want a solution involving only DV. You can have List DV
(which gives you the dropdown) and additional valdiation through VBA
to test for date <=TODAY().

'------------------------------
Private remembered

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$2" Then
If Int(Target.Value) = Int(Now) Then
MsgBox "Date must be earlier than today"
Target.Value = remembered
End If
End If
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$A$2" Then
remembered = Target.Value
End If

End Sub

'--------------------------

Right-click on the sheet tab. Choose View COde. Paste the above code
in the VBA IDE window that will show up.

HTH
Kostis

On 20 Ιαν, 12:37, Seanie wrote:
Thanks, but is it possible to do with a Drop Down list in A2?


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Select from a List

How about having the DV via a dynamic source range,
display only the valid dates?

Assume source dates are listed in Sheet1's A1:A20
In B1: =IF(A1="","",IF(A1<=TODAY(),ROW(),""))
In C1: =INDEX(A:A,SMALL(B:B,ROW()))
Copy B1:C1 down to C20

Then create a defined range: MyR
to refer to:
=OFFSET(Sheet1!$C$1,,,SUMPRODUCT(--ISNUMBER(Sheet1!$C$1:$C$20)))

Now you can use MyR as the source in the DVs,
and it'll always display only the list of valid dates
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:22,500 Files:370 Subscribers:66
xdemechanik
---
"Seanie" wrote in message
...
Thanks, but is it possible to do with a Drop Down list in A2?





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 LIST- CAN I SELECT FROM LIST WITHOUT SCROLLING Bellyjean Excel Worksheet Functions 1 March 7th 08 09:46 PM
To select from a list anil Excel Discussion (Misc queries) 1 April 24th 07 12:50 PM
To select from a list anil Excel Discussion (Misc queries) 0 April 24th 07 09:28 AM
Select from List Box Franko Excel Worksheet Functions 0 November 22nd 06 12:42 PM
how to randomly select a name in a list and then the select the ne [email protected] Excel Worksheet Functions 1 September 20th 06 08:09 AM


All times are GMT +1. The time now is 07:56 AM.

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"