View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Move Cell in Column A to Column B when FIND

Hi juan

Try this example that look for ron in column A

Sub Example()
Dim Firstrow As Long
Dim Lastrow As Long
Dim Lrow As Long
Dim CalcMode As Long

With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

Firstrow = ActiveSheet.UsedRange.Cells(1).Row
Lastrow = ActiveSheet.UsedRange.Rows.Count + Firstrow - 1
With ActiveSheet
.DisplayPageBreaks = False
For Lrow = Lastrow To Firstrow Step -1
If IsError(.Cells(Lrow, "A").Value) Then
'Do nothing, This avoid a error if there is a error in the cell

ElseIf .Cells(Lrow, "A").Value = "ron" Then
.Cells(Lrow, "A").Value = ""
.Cells(Lrow, "A").Offset(0, 1).Value = "ron"
End If
Next
End With
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"juan" wrote in message ...
Hello,
I looked in post and found something what I'm looking to
do but instead of formatting a cell I want to move that
cell to column B next to it.
Here's part of the code where I need to do this:
If Not rng Is Nothing Then
FirstAddress = rng.Address
Do
rng. (Here's where I need to put the
code to move to Column B)

Set rng = .FindNext(rng)
Loop While Not rng Is Nothing And
rng.Address < FirstAddress
End If
Next I
End With
Basically what I want is find the word Total in COLUMN A
then when it finds it move to Column B continue until no
more and then I want to delete column A.

Hope this makes sense.
any help would be very appreciated.
thanks,
juan