【发布时间】:2020-07-24 03:33:26
【问题描述】:
有没有办法在 A 列等列表中搜索一个值,确定该值的行号(例如,它可能是 A 列的第 40 行),转到不同的列(例如第 40 行, 列 B),然后通过宏将数据插入该列(因此它是自动完成的)。
我尝试过使用下面的代码,但似乎无法到达任何地方;
Dim Cell As Range
Dim RowNumber As Long
Columns("B:B").Select
Set cell = Selection.Find(What:="celda", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
RowNumber = Cell.Row
If cell = "celda" Then
'find row, go to Column B of that row, and insert "abc"
Else
'do it another thing
End If
我在下面的链接中找到了上面的代码;
- How to find a value in an excel column by vba code Cells.Find(不是我自己的作品,而是给创作者的道具)
【问题讨论】: