Hi guys,
I've been trying to write a code that looks for all references of a given number (Plan6.Cells(conter2, 2)) in a sheet (Plan8), and then pastes the information of other cells in the same row at a different sheet ( the ActiveSheet, Plan7 in this case). The problem is that my FindNext function doesn't work, just the first Find. Because of that my loop runs only one time, since the adresses don't change. Here's the part of the code that's not working
With Plan8.Columns("C")
Set spo = .Find(Plan6.Cells(conter2, 2), LookIn:=xlFormulas, _
lookat:=xlWhole, searchdirection:=xlNext)
firstAddress = spo.Address
Do
ActiveCell.Offset(1, 0).Select
ActiveCell = spffset(0, 1)
Set spo = .FindNext(after:=spo)
Loop While Not spo Is Nothing And spo.Address <> firstAddress
End With
I'm trying to learn vba by myself and by using this forums, so any help would be great.
Best regards from Brazil!
I've been trying to write a code that looks for all references of a given number (Plan6.Cells(conter2, 2)) in a sheet (Plan8), and then pastes the information of other cells in the same row at a different sheet ( the ActiveSheet, Plan7 in this case). The problem is that my FindNext function doesn't work, just the first Find. Because of that my loop runs only one time, since the adresses don't change. Here's the part of the code that's not working
With Plan8.Columns("C")
Set spo = .Find(Plan6.Cells(conter2, 2), LookIn:=xlFormulas, _
lookat:=xlWhole, searchdirection:=xlNext)
firstAddress = spo.Address
Do
ActiveCell.Offset(1, 0).Select
ActiveCell = spffset(0, 1)
Set spo = .FindNext(after:=spo)
Loop While Not spo Is Nothing And spo.Address <> firstAddress
End With
I'm trying to learn vba by myself and by using this forums, so any help would be great.
Best regards from Brazil!