ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Move cell contain from Column A to B anythign with the word Total (https://www.excelbanter.com/excel-programming/370032-move-cell-contain-column-b-anythign-word-total.html)

Juan

Move cell contain from Column A to B anythign with the word Total
 
Hello All,
I want to move any cells that contain the word Total in Column A to Columb
B. I have a macro, but I have to have the exact name. Example of the code:

ElseIf .Cells(lRow, "A").Value = "01 Total" Then
.Cells(lRow, "A").Value = ""
.Cells(lRow, "A").Offset(0, 1).Value = "01 Total"
ElseIf .Cells(lRow, "A").Value = "02 Total" Then
.Cells(lRow, "A").Value = ""
.Cells(lRow, "A").Offset(0, 1).Value = "02 Total"

So want to just have the word Total in the code and it will move those cells.

So would appreciate any help.

Thanks,

J










Ron de Bruin

Move cell contain from Column A to B anythign with the word Total
 
Try this

Sub testing()
For Each cell In Columns("A").SpecialCells(xlCellTypeConstants)
If cell.Value Like "*Total*" Then
cell.Offset(0, 1).Value = cell.Value
cell.Value = ""
End If
Next cell
End Sub


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



"Juan" wrote in message ...
Hello All,
I want to move any cells that contain the word Total in Column A to Columb
B. I have a macro, but I have to have the exact name. Example of the code:

ElseIf .Cells(lRow, "A").Value = "01 Total" Then
.Cells(lRow, "A").Value = ""
.Cells(lRow, "A").Offset(0, 1).Value = "01 Total"
ElseIf .Cells(lRow, "A").Value = "02 Total" Then
.Cells(lRow, "A").Value = ""
.Cells(lRow, "A").Offset(0, 1).Value = "02 Total"

So want to just have the word Total in the code and it will move those cells.

So would appreciate any help.

Thanks,

J












Jim Jackson

Move cell contain from Column A to B anythign with the word Total
 
For each cell in sheets
Do
If Right(Activecell,5) = "Total" Then
'make the move
End if
Activecell.Offset(1,0).Activate
Loop while activecell ""
Next
--
Best wishes,

Jim


"Juan" wrote:

Hello All,
I want to move any cells that contain the word Total in Column A to Columb
B. I have a macro, but I have to have the exact name. Example of the code:

ElseIf .Cells(lRow, "A").Value = "01 Total" Then
.Cells(lRow, "A").Value = ""
.Cells(lRow, "A").Offset(0, 1).Value = "01 Total"
ElseIf .Cells(lRow, "A").Value = "02 Total" Then
.Cells(lRow, "A").Value = ""
.Cells(lRow, "A").Offset(0, 1).Value = "02 Total"

So want to just have the word Total in the code and it will move those cells.

So would appreciate any help.

Thanks,

J










Juan

Move cell contain from Column A to B anythign with the word To
 

Hello Ron and Jim,

Thanks alot for the help.

Really appreciated.

Thanks,

J


"Jim Jackson" wrote:

For each cell in sheets
Do
If Right(Activecell,5) = "Total" Then
'make the move
End if
Activecell.Offset(1,0).Activate
Loop while activecell ""
Next
--
Best wishes,

Jim


"Juan" wrote:

Hello All,
I want to move any cells that contain the word Total in Column A to Columb
B. I have a macro, but I have to have the exact name. Example of the code:

ElseIf .Cells(lRow, "A").Value = "01 Total" Then
.Cells(lRow, "A").Value = ""
.Cells(lRow, "A").Offset(0, 1).Value = "01 Total"
ElseIf .Cells(lRow, "A").Value = "02 Total" Then
.Cells(lRow, "A").Value = ""
.Cells(lRow, "A").Offset(0, 1).Value = "02 Total"

So want to just have the word Total in the code and it will move those cells.

So would appreciate any help.

Thanks,

J











All times are GMT +1. The time now is 08:33 AM.

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