验证单元格是否设置了数据有效性

'验证数据是否有效性
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

 

posted @ 2021-01-26 15:09  蜗牛的礼物  阅读(138)  评论(0编辑  收藏  举报