View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Adding Validation When Source Validates To Error?

As I recall,
Relative references in Data Validation are relative to the ActiveCell where
ever that may be. I don't know what you are doing, but maybe select the cell
with the data validation before applying it. Also, perhaps you need to at
least temporarily populate the cell references to insure the formula does not
evaluate to an error.

--
Regards,
Tom Ogilvy


"(PeteCresswell)" wrote:

Per Tom Ogilvy:
myWS.Application.DisplayAlerts = False


Seems to have the desired effect if/when I jump over to the
worksheet and manually apply Formula1:="=INDIRECT(RC[-1])"

But the code still traps out with a 1004 on line 2474.
viz:
==================================================
2470 Set myRange = Range(.Cells(1, 2), .Cells(6, 2))
2471 mySS.Application.DisplayAlerts = False 'BC this box's
validation validates to an error since it is intially blank
2472 With myRange.Validation
2473 .Delete
2474 .Add Type:=xlValidateList,
AlertStyle:=xlValidAlertStop, Operator:=xlBetween,
Formula1:="=INDIRECT(RC[-1])"
2475 .IgnoreBlank = True
2476 .InCellDropdown = True
2477 End With
2479 mySS.Application.DisplayAlerts = False
2499 End With

==================================================

Maybe I'm jumping to cause with the "..evaluates to an error"
explaination and doing something else that's
provoking the 1004?
--
PeteCresswell