Problem changing validation on an adjoining cell via selection_change

NewOrderFac33

Well-known Member
Joined
Sep 26, 2011
Messages
1,283
Office Version
  1. 2016
  2. 2010
Platform
  1. Windows
Good morning - just wondering if anyone can help.

I'm attempting to set up a project planning database that will contain a number of sub tasks that will be performed by a named person in a named team.

The idea is that when a team is selected from a drop down list, the adjoing cell's validation will change so that it only contains a drop down list containing members of that specific team.

Each team's members are contained in a specific named range and the whole thing is packaged in worksheet_selectionchange - this idea is that when you change the team, the change is picked up and the adjoing cell will then contain a drop down comprising the named range for that team.

The problem that I have is that I keep getting the following message when Ii change the entry in the "Team" column:

Runtime error -2147417848 (80010108)
Automation error
The object invoked has disconnected from its clients

The funny thing is, that when I click "End", the result is exactly what I wanted - the validation in the adjoining cell correctly reflects the change in the Team Name.

What's going on?

here's a section of the Worksheet_Change code

Code:
 Case Is = "Analysis"
                    MsgBox ("Analysis")
                    Target.Offset(0, -4).Resize(1, 17).Interior.ColorIndex = 40 
                    Target.Offset(0, -4).Resize(1, 17).Font.ColorIndex = 1 
                    Target.Offset(0, 1).Select
                    With Selection.Validation
                       .Delete
                       .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="=Analysis"
                       .IgnoreBlank = True
                       .InCellDropdown = True
                       .InputTitle = ""
                       .ErrorTitle = ""
                       .InputMessage = ""
                       .ErrorMessage = ""
                       .ShowInput = True
                       .ShowError = False
                    End With

Originally, instead of

Code:
Target.Offset(0, 1).Select
With Selection.Validation

I had

Code:
with  target.Offset(0, 1)
I tried the select to see if the problem lay with setting validation against a target offset, but the results are the same.

This is driving me nuts - any assistance gratefully accepted!
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Forum statistics

Threads
1,223,888
Messages
6,175,207
Members
452,618
Latest member
Tam84

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top