vba如何判断单元格设置了数据有效性(validation)
因为使用validation.formula1时,由于部分单元格没有设置有效性,导致程序异常。求一方法避免异常谢谢...
因为使用validation.formula1时,由于部分单元格没有设置有效性,导致程序异常。
求一方法避免异常
谢谢 展开
求一方法避免异常
谢谢 展开
2个回答
展开全部
Sub test()
Dim i As Integer
On Error Resume Next
For i = 1 To 5
MsgBox Cells(i, 1).Validation.Formula1
Next i
On Error GoTo 0
End Sub
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
1
2
3
4
5
6
7
8
Sub test()
Dim i As Integer
On Error Resume <a href="https://www.baidu.com/s?wd=Next&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1Y3njnsmHw9uHI9nH-hnym40ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6K1TL0qnfK1TL0z5HD0IgF_5y9YIZ0lQzqlpA-bmyt8mh7GuZR8mvqVQL7dugPYpyq8Q1DYn10vnW6snjDvPWDdn1ckP1b" target="_blank" class="baidu-highlight">Next</a>
For i = 1 To 5
MsgBox Cells(i, 1).Validation.Formula1
<a href="https://www.baidu.com/s?wd=Next&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1Y3njnsmHw9uHI9nH-hnym40ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6K1TL0qnfK1TL0z5HD0IgF_5y9YIZ0lQzqlpA-bmyt8mh7GuZR8mvqVQL7dugPYpyq8Q1DYn10vnW6snjDvPWDdn1ckP1b" target="_blank" class="baidu-highlight">Next</a> i
On Error GoTo 0
End Sub
2
3
4
5
6
7
8
Sub test()
Dim i As Integer
On Error Resume <a href="https://www.baidu.com/s?wd=Next&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1Y3njnsmHw9uHI9nH-hnym40ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6K1TL0qnfK1TL0z5HD0IgF_5y9YIZ0lQzqlpA-bmyt8mh7GuZR8mvqVQL7dugPYpyq8Q1DYn10vnW6snjDvPWDdn1ckP1b" target="_blank" class="baidu-highlight">Next</a>
For i = 1 To 5
MsgBox Cells(i, 1).Validation.Formula1
<a href="https://www.baidu.com/s?wd=Next&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1Y3njnsmHw9uHI9nH-hnym40ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6K1TL0qnfK1TL0z5HD0IgF_5y9YIZ0lQzqlpA-bmyt8mh7GuZR8mvqVQL7dugPYpyq8Q1DYn10vnW6snjDvPWDdn1ckP1b" target="_blank" class="baidu-highlight">Next</a> i
On Error GoTo 0
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询