How to detect if changed cell has data validation as a list

fraz627

Board Regular
Joined
Apr 26, 2014
Messages
99
Office Version
  1. 2010
Platform
  1. Windows
I am working on way to add items to a data validation list box.
I kind of got it sorted out by adding to top of the list box "ADD NEW"
and when that selection is made Use a user form to add a new entry and resize the named range.

but not sure how to detect on a worksheet change event to determine if the cell has data validation.
Thanks
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Here is a little reusable function that will determine if a cell has data validation:
VBA Code:
Function HasDataValidation(ByVal Cell As Range) As Boolean
    Dim eRes As XlDVType
    On Error Resume Next
    eRes = Cell.Validation.Type
    HasDataValidation = Not CBool(Err.Number)
End Function

Use it like this :
MsgBox HasDataValidation(Range("A1"))
 
Upvote 0
Here is a little reusable function that will determine if a cell has data validation:
VBA Code:
Function HasDataValidation(ByVal Cell As Range) As Boolean
    Dim eRes As XlDVType
    On Error Resume Next
    eRes = Cell.Validation.Type
    HasDataValidation = Not CBool(Err.Number)
End Function

Use it like this :
MsgBox HasDataValidation(Range("A1"))
 
Upvote 0

Forum statistics

Threads
1,215,455
Messages
6,124,938
Members
449,197
Latest member
k_bs

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