ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   VBA Code - Find & Move (https://www.excelbanter.com/excel-discussion-misc-queries/208069-vba-code-find-move.html)

Youlan

VBA Code - Find & Move
 
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

Bernie Deitrick

VBA Code - Find & Move
 
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


"Youlan" wrote in message
...
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




Youlan

VBA Code - Find & Move
 
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,

"Bernie Deitrick" wrote:

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


"Youlan" wrote in message
...
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





Bernie Deitrick

VBA Code - Find & Move
 
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


"Youlan" wrote in message
...
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,

"Bernie Deitrick" wrote:

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


"Youlan" wrote in message
...
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







Youlan

VBA Code - Find & Move
 
Thats perfect...thanks a million

"Bernie Deitrick" wrote:

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


"Youlan" wrote in message
...
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,

"Bernie Deitrick" wrote:

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


"Youlan" wrote in message
...
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








All times are GMT +1. The time now is 07:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com