I think I have the fix. The problem is that adding validation to a
range fails if there are no cells selected on the worksheet (I
think). Sometimes this code was being called from a command button
click, and the button took the focus away from the underlying sheet,
meaning that adding the validation failed.
I haven't seen any documentation on when you can add validation to a
range, but this poster below ran into the same issue.
http://www.mcse.ms/message734048.html
Philip.
On Feb 12, 4:10 pm, "Jim Cone" wrote:
Phillip,
My guess is that you have other unqualified objects in your code.
The KB you referenced is not devoted to clarity but does provide
clues to most of the Excel automation problems posted in this group.
Do you have object references to...
Excel
The Workbook
The Sheet
The Validation object
Do you Set all objects to Nothing before exiting your code?
Are they set to Nothing in child to parent order?
After exiting your code, have you checked Task Manager to see if
an instance of Excel remains?
--
Jim Cone
San Francisco, USAhttp://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)