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

G

Guest

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
 
R

Ron de Bruin

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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top