查看以下代码:
Sub tickscale_table()
exch = Cells(I, 13).Value
Worksheets("tickscale").Activate
Range("A1").Activate
Cells.Find(What:=exch, After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:=True _
, SearchFormat:=False).Activate
If ms = ActiveCell.Offset(0, 1) And cr = ActiveCell.Offset(0, 3) Then
tickscaletype = ActiveCell.Offset(0, 4).Value2 And tickcale = ActiveCell.Offset(0,5).Value2
End If
上面是我试图在excelsheet表中搜索值的代码,当在第一列中找到该值时,如果条件为真,我将搜索同一行中另一列的值ms
并cr
满足该值。maketickscaletype
和tickscale
等于同一行中另一列的值。
我的类型不匹配
tickscaletype=ActiveCell.Offset(0,4).value
我尝试声明,tisckscaletype
并将其tickscale
作为变体,范围,字符串,保留为空,但仍然收到错误。
这段代码对我来说没有意义
tickscaletype = ActiveCell.Offset(0, 4).Value2 And tickcale = ActiveCell.Offset(0,5).Value2
你应该有
tickscaletype = ActiveCell.Offset(0, 4).Value2
tickcale = ActiveCell.Offset(0,5).Value2
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句