Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Move Cell in Column A to Column B when FIND

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Move Cell in Column A to Column B when FIND

Hello Ron,
you are great!!!!!! This seems to work like a charm.
Thanks alot for the help. I try to work with what I find
in the post but sometimes I can't figured out. So have to
ask.

Once again thanks,

Juan
-----Original Message-----
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



.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Maddening Dilemma - Compare each cell within column a to each cell in column b and find unique matches [email protected] Excel Worksheet Functions 66 May 1st 23 03:44 AM
Macro to find and move column andrea Excel Discussion (Misc queries) 1 October 9th 08 02:22 PM
Find max value in one column and return the value of corrosponding cell in different column [email protected] Excel Worksheet Functions 5 October 16th 07 12:33 PM
Find last column, move formulas over, copy/paste data Mike R. Excel Worksheet Functions 0 September 19th 07 06:40 AM
move contents of column C based on criteria related to column A Debra Excel Discussion (Misc queries) 2 December 27th 05 10:25 PM


All times are GMT +1. The time now is 02:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"