VBA help finding a word then copy cell above [Solved/Closed]

Report
-
 weenie -
Hello,
I don't know where to begin writing a macro for the following: I have 2007excel & In column A I have these numbers in parentheses and the word "vto". What I would like to do is look through entire column A and the numbers of rows can vary. To look for the word "vto" and once it finds it to copy the cell below it (it can also be cell below so it does not matter) then paste into the cell where "vto" is. Any help woud be great!! Thank you
Below is a sample of my column
A
(20/5.5)
(20/5.5)
(20/5.5)
(20/5.5)
(20/5.5
(20/1.0)
(20/1.0)
(20/1.0)
(20/1.0)
vto
(20/1.0)
(20/1.0)
(20/1.0)
(20/1
(20/1.0
(20/0.8)
(20/0.8)
(20/0.8)
(20/0.8)
vto
(20/0.8)
(20/0.8)
Thank you,
Irene

1 reply

Posts
2644
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
August 31, 2020
432
Hi Irene,

Try this code:
Sub test()
Set MyRng = Range(Cells(1, "A"), Cells(Rows.Count, "A").End(xlUp))
For Each cell In MyRng
    If cell.Value = "vto" Then
    cell.Value = cell.Offset(-1, 0).Value
        End If
    Next
End Sub

Let me know how this works for you.

Best regards,
Trowa