Reputation: 159
I have a excel sheet with some data. In Column A, it has set of data, my objective is to copy the cell value below the cell which contains its value as "Line".
Columns("B:B").Select
Set cell = Selection.Find(What:="line", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
If cell Is Nothing Then
'do it something
Else
'do it another thing
End If
But it is used to find only the cell value which contains as Line.
Upvotes: 0
Views: 125
Reputation: 23974
To reference the cell which is one row below, and zero columns to the right of, the cell referred to by your cell
variable you can use cell.Offset(1, 0)
.
(Obviously, this can only be done if cell
isn't Nothing
, so needs to be used only in the Else
leg of your code's If
statement.)
Upvotes: 2