[英]Excel-VBA Range.Find method error handling
用这个。 如果您直接想返回一个空范围的列号,它将显示错误。
Sub findtest()
dim c as long
dim rng as range
Set rng = ActiveSheet.Rows("1:1").Find(What:="John Smith", _
After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
If Not rng Is Nothing Then c = rng.column : Debug.Print c
end sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.