View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
J Streger J Streger is offline
external usenet poster
 
Posts: 101
Default Problems entering Data validation Programatically

I have one code that uses the change event to add validation boxes to any row
that doesn't have them.

I have another code to insert a special row, that has special validation
boxes(apart from the change event). My change event has a variable that stops
the change event from running while it's in process.

The problem is that when I activate the cahnge event, the validation runs
smoothly and is inserted into the sheet, using named ranges from another
sheet as the values for the drop down box. When I try to insert the special
row, and I use the exact same code to add the validation, it errors on the
add line:

With ActiveSheet.Range(Cells(iRow, iColumn).Address).Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:=sRange

As you can see, I delete the current validation so that I can always use an
add routine. When I set a watch VBA sees the validation, but won't run the
line. I have tried removing all variables and tired not referring to a anmed
range and still get the error. I am using Excel 2000. Any ideas on why the
code will work in one procedure but not in another?

*********************
J Streger
MS Office Master 2000 ed.
MS Project White Belt 2003