Heya,

It's as simple as the subject states but I can't seem to find an
answer anywhere.

My code at the moment is:

Worksheets(Array("Sat EEA", "Sun EEA", "Mon EEA", "Tue EEA", "Wed
EEA", "Thu EEA", _
        "Fri EEA", "Sat NonEEA", "Sun NonEEA", "Mon NonEEA", "Tue
NonEEA", "Wed NonEEA", _
        "Thu NonEEA", "Fri NonEEA")).Select

'Column C Validation
    With Range("C9").Validation
        .Delete
        .Add Type:=xlValidateTime, AlertStyle:=xlValidAlertStop,
Operator:= _
        xlBetween, Formula1:="12:00:00 AM", Formula2:="12:59:00 AM"
        .ErrorTitle = "Invalid Entry"
        .InputMessage = "Enter a time between 00:00 (12 AM) and 00:59"
        .ErrorMessage = _
        "This row is for measurements commencing between 00:00 (12 AM)
and 00:59 only."
    End With

    With Range("C10").Validation
        .Delete
        .Add Type:=xlValidateTime, AlertStyle:=xlValidAlertStop,
Operator:= _
        xlBetween, Formula1:="01:00:00 AM", Formula2:="01:59:00 AM"
        .ErrorTitle = "Invalid Entry"
        .InputMessage = "Enter a time between 01:00 and 01:59"
        .ErrorMessage = _
        "This row is for measurements commencing between 01:00 and
01:59 only."
    End With

    With Range("C11").Validation
        .Delete
        .Add Type:=xlValidateTime, AlertStyle:=xlValidAlertStop,
Operator:= _
        xlBetween, Formula1:="02:00:00 AM", Formula2:="02:59:00 AM"
        .ErrorTitle = "Invalid Entry"
        .InputMessage = "Enter a time between 02:00 and 02:59"
        .ErrorMessage = _
        "This row is for measurements commencing between 02:00 and
02:59 only."
    End With

'Continues for ~20 other cells.

End sub

Validation doesn't appear to work when sheets are selected as an array
and I'd rather not copy and paste the 100+ lines of code for each
sheet in the workbook. I cannot use For Each Worksheet as a few sheets
do not need the validation.

Any ideas?

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 6,800 subscribers worldwide and receive many nice notes about the 
learning and support from the group.Let friends and co-workers know they can 
subscribe to group at http://groups.google.com/group/excel-macros/subscribe

Reply via email to