Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Maddening Dilemma - Compare each cell within column a to each cell in column b and find unique matches | Excel Worksheet Functions | |||
Macro to find and move column | Excel Discussion (Misc queries) | |||
Find max value in one column and return the value of corrosponding cell in different column | Excel Worksheet Functions | |||
Find last column, move formulas over, copy/paste data | Excel Worksheet Functions | |||
move contents of column C based on criteria related to column A | Excel Discussion (Misc queries) |