LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 219
Default Data Validation

Trying to validate in the following scenario:
Cells H7 and I7 have dates in them (testing using 8/3/09 and 8/4/09).
Before an entry can be made in K7, I have a custom formula to check and see
that both dates in H7 and I7 are in the same month. The following code is
supposed to enter the validation criteria:

Public Sub DataValidationBDOCsmEDOC()

With Selection.Validation
.Delete
.Add Type:=xlValidateDate, AlertStyle:=xlValidAlertStop, Operator:= _
xlGreater, Formula1:="=MONTH(H" & lCurRow & ")=MONTH(I" & lCurRow &
")"
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = "EDOC not same month as BDOC"
.InputMessage = ""
.ErrorMessage = _
"The BDOC and the EDOC are in different months." _
& Chr(10) & "Please correct these dates before entering the rates."
.ShowInput = False
.ShowError = True
End With

End Sub

The resulting custom formula in the Data Validation box is

=MONTH(H7)=MONTH(I7)

But when I put in dates of 8/3/09 and 8/4/09, it tells me they aren't in
the same month. When I put "=MONTH(H7)" and "=(MONTH(I7)" in other cells,
they both evaluate to 8. So why am I getting an invalid data message?

Thanks in advance.
 
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
custom data validation on cells with data validation values AKrobbins Excel Worksheet Functions 2 June 21st 11 04:20 PM
Validation Data using Validation Table cell range..... Dermot Excel Discussion (Misc queries) 16 January 5th 10 09:35 PM
Crazy Data Validation ... List Validation Not Working TW Bake Excel Programming 1 March 29th 07 02:41 AM
data validation invalid in dynamic validation list ilia Excel Worksheet Functions 0 November 7th 06 12:54 PM
Data validation with validation lists and combo boxs Keith Excel Discussion (Misc queries) 1 October 12th 06 11:08 AM


All times are GMT +1. The time now is 03:23 PM.

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"