VBA Code - Find & Move

Y

Youlan

Hi,

I'm using Excel 2002 and I need a code that can perform the following
operation:
1) Find text "REPO"
2) Once found, Move to the cell directly below it (-1, r)
3) Delete Entire Row where text was originally (+ ,r )

Thanks in advance
 
B

Bernie Deitrick

Youlan,

Sub TryNow()
Dim myC As Range
Set myC = Cells.Find("REPO")
myC(2).Select
myC.EntireRow.Delete
End Sub

HTH,
Bernie
MS Excel MVP
 
Y

Youlan

Hi

Thanks for your response but I would also need to select the cell with
"REPO" once found and move it to cell directly below and then delete the row
where "REPO" was originally.

Can you help me with that please?

Regards,
 
B

Bernie Deitrick

Sorry - I read your move as move to the next cell, not move the cell to the next row.

Sub TryNow2()
Dim myC As Range
Dim myR As Long
Set myC = Cells.Find("REPO")
myR = myC.Row
myC.Cut myC(2)
Cells(myR, 1).EntireRow.Delete
End Sub

HTH,
Bernie
MS Excel MVP
 
Y

Youlan

Thats perfect...thanks a million

Bernie Deitrick said:
Sorry - I read your move as move to the next cell, not move the cell to the next row.

Sub TryNow2()
Dim myC As Range
Dim myR As Long
Set myC = Cells.Find("REPO")
myR = myC.Row
myC.Cut myC(2)
Cells(myR, 1).EntireRow.Delete
End Sub

HTH,
Bernie
MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top