Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default 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









  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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











  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 324
Default 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









  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default 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









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
if a word is in a cell I want the total in that column AHOBBS Excel Discussion (Misc queries) 3 April 23rd 06 12:22 PM
move column total in pivot table to begining flow23 Excel Discussion (Misc queries) 0 December 8th 05 01:02 PM
Find the word "total" in a cell, delete row or column Lawlerd[_3_] Excel Programming 1 October 22nd 04 12:14 AM
Find the word "total" in a cell, delete row or column Lawlerd[_2_] Excel Programming 1 October 20th 04 02:32 PM
Find the word "total" in a cell, delete row or column Lawlerd Excel Programming 1 October 20th 04 12:02 PM


All times are GMT +1. The time now is 09:05 PM.

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

About Us

"It's about Microsoft Excel"