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

weenie - Sep 10, 2010 at 11:51 AM - Latest reply:  weenie
- Sep 17, 2010 at 07:00 PM
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
See more 

2 replies

TrowaD 2433 Posts Sunday September 12, 2010Registration dateContributorStatus September 17, 2018 Last seen - Sep 14, 2010 at 09:29 AM
0
Thank you
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