验证单元格是否设置了数据有效性
'验证数据是否有效性 Function IsValidationData(ByVal Target As Range, columnNuber As Integer) On Error GoTo Line If Sheets("Sheet1").Cells(Target.Row, columnNuber).Validation.Type = 3 Then IsValidationData = True Exit Function End If Line: IsValidationData = False End Function
将上面放入模块2中
调用
If IsValidationData(Target, shoeFactoryColumn) Then '清除数据有效性 Sheets("Sheet1").Cells(Target.Row, shoeFactoryColumn).Validation.Delete End If
感谢:http://www.excelpx.com/thread-173134-1-1.html