vba 判断 区域a1 :m9
上有没有插入文本框 excel
可以用下面这段程序来判断:
Sub myshape()
isshape = 0
For Each tbox In ActiveSheet.Shapes
If tbox.Type = msoTextBox Then
irow1 = tbox.TopLeftCell.Row '获的shape对象的左上角所在单元格的行号
icol1 = tbox.TopLeftCell.Column '获的shape对象的左上角所在单元格的的列号
If irow1 <= 9 And icol1 <= 13 Then
MsgBox "有文本框"
isshape = 1
Exit For
End If
End If
Next
If isshape = 0 Then
MsgBox "没有文本框"
End If
End Sub
Sub myshape()
isshape = 0
For Each tbox In ActiveSheet.Shapes
If tbox.Type = msoTextBox Then
irow1 = tbox.TopLeftCell.Row '获的shape对象的左上角所在单元格的行号
icol1 = tbox.TopLeftCell.Column '获的shape对象的左上角所在单元格的的列号
If irow1 <= 9 And icol1 <= 13 Then
MsgBox "有文本框"
isshape = 1
Exit For
End If
End If
Next
If isshape = 0 Then
MsgBox "没有文本框"
End If
End Sub
温馨提示:答案为网友推荐,仅供参考