Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Any exmamples of how to use Programatic Data Validation? For example I'd like to restrict the users from entering letters in a date column. I'm assuming the code is rather short, just haven't been able to figure it out yet. Thanks
|
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
Rightclick sheet tab, choose "view code", paste this in : Private Sub Worksheet_Change(ByVal Target As Range) With Target(1) If .Column = 1 Then 'A column If .Value < "" Then If IsDate(.Value) = False Then _ .Value = "" End If End If End With End Sub HTH. Best wishes Harald "Jdibble" skrev i melding ... Any exmamples of how to use Programatic Data Validation? For example I'd like to restrict the users from entering letters in a date column. I'm assuming the code is rather short, just haven't been able to figure it out yet. Thanks |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Just some added info
When using the change event to change a value in the cell that triggered the event, it is advisabel to disable events to prevent recursive calling Private Sub Worksheet_Change(ByVal Target As Range) On Error goto ErrHandler With Target(1) If .Column = 1 Then 'A column If .Value < "" Then If IsDate(.Value) = False Then _ Application.EnableEvents = False .Value = "" End If End If End With Errhandler: Application.EnableEvents = True End Sub -- Regards, Tom Ogilvy "Harald Staff" wrote in message ... Hi Rightclick sheet tab, choose "view code", paste this in : Private Sub Worksheet_Change(ByVal Target As Range) With Target(1) If .Column = 1 Then 'A column If .Value < "" Then If IsDate(.Value) = False Then _ .Value = "" End If End If End With End Sub HTH. Best wishes Harald "Jdibble" skrev i melding ... Any exmamples of how to use Programatic Data Validation? For example I'd like to restrict the users from entering letters in a date column. I'm assuming the code is rather short, just haven't been able to figure it out yet. Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
custom data validation on cells with data validation values | Excel Worksheet Functions | |||
Validation Data using Validation Table cell range..... | Excel Discussion (Misc queries) | |||
data validation invalid in dynamic validation list | Excel Discussion (Misc queries) | |||
data validation invalid in dynamic validation list | Excel Worksheet Functions | |||
Data validation with validation lists and combo boxs | Excel Discussion (Misc queries) |