Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Replace with total

Hello all,
I have in Column A customers that have a * and two extra
spaces.These customers that contain such thing is the
total for that customer . Example,
Column A
* Test Tech
* tech is this

Is it possible to replace the *Spacespace to Total?Exa,
Total Test Tech
Total tech is this

If I do the Find Replace, it will cause some errors
because of the * and space.
Please advise any help.
Thanks,
Juan

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Replace with total

Hi Juan,

This line of code works for me:

Worksheets("Sheet1").Columns(1).Replace "* ", "Total "

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Juan wrote:
Hello all,
I have in Column A customers that have a * and two extra
spaces.These customers that contain such thing is the
total for that customer . Example,
Column A
* Test Tech
* tech is this

Is it possible to replace the *Spacespace to Total?Exa,
Total Test Tech
Total tech is this

If I do the Find Replace, it will cause some errors
because of the * and space.
Please advise any help.
Thanks,
Juan

  #3   Report Post  
Posted to microsoft.public.excel.programming
tod tod is offline
external usenet poster
 
Posts: 114
Default Replace with total

You could try something like this:

Dim ChangeRange as Range
Dim Cell as Range

Set ChangeRange = ActiveSheet.Range("A1:A100")
For each Cell in ChangeRange
If Left(Cell,3) = "* " then
Cell.Value = "Total " & Trim(Right(Cell,Len(Cell)-3))
End If
Next Cell
-----Original Message-----
Hello all,
I have in Column A customers that have a * and two extra
spaces.These customers that contain such thing is the
total for that customer . Example,
Column A
* Test Tech
* tech is this

Is it possible to replace the *Spacespace to Total?Exa,
Total Test Tech
Total tech is this

If I do the Find Replace, it will cause some errors
because of the * and space.
Please advise any help.
Thanks,
Juan

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Replace with total

Hi Juan,

In order to replace the asterisk (*) symbol. I beleive tha you need to use
use the two symbol combination
~*
If you use the asterisk alone, it will be interpreted as a wildcard.

You can do this manually or in vba:

Sub ReplaceAsteriskSpace()
Dim cell As Range

For Each cell In Selection
cell.Replace What:="~*", Replacement:="Total", _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
MatchCase:=False
cell.Value = Application.Trim(cell.Value)
Next
End Sub

---
Regards,
Norman

"Juan" wrote in message
...
Hello all,
I have in Column A customers that have a * and two extra
spaces.These customers that contain such thing is the
total for that customer . Example,
Column A
* Test Tech
* tech is this

Is it possible to replace the *Spacespace to Total?Exa,
Total Test Tech
Total tech is this

If I do the Find Replace, it will cause some errors
because of the * and space.
Please advise any help.
Thanks,
Juan



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default Replace with total

In the Find What box, type ~* followed by 2 spaces
In the Replace With box, type Total and 1 space


On Wed, 28 Jul 2004 12:25:13 -0700, "Juan" wrote:

Hello all,
I have in Column A customers that have a * and two extra
spaces.These customers that contain such thing is the
total for that customer . Example,
Column A
* Test Tech
* tech is this

Is it possible to replace the *Spacespace to Total?Exa,
Total Test Tech
Total tech is this

If I do the Find Replace, it will cause some errors
because of the * and space.
Please advise any help.
Thanks,
Juan




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Replace with total

Jake Marx wrote:
This line of code works for me:

Worksheets("Sheet1").Columns(1).Replace "* ", "Total "


My fault - as Myrna and Norman pointed out, you should preface the * with a
~:

Worksheets("Sheet1").Columns(1).Replace "~* ", "Total "

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Replace with total

Hello all,
sorry for late reply. Just wanted to thank all of you who
contributed help. I tested the info and works great. So
once again thanks to all of you for taking the time.

Have a greatt end of week.

Juan
-----Original Message-----
Jake Marx wrote:
This line of code works for me:

Worksheets("Sheet1").Columns

(1).Replace "* ", "Total "

My fault - as Myrna and Norman pointed out, you should

preface the * with a
~:

Worksheets("Sheet1").Columns

(1).Replace "~* ", "Total "

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address

unmonitored]

.

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
Duplicate Running Total Grand Total In Pivot Table Mathew P Bennett[_2_] Excel Discussion (Misc queries) 1 August 17th 08 03:13 AM
WHY DO HASHES REPLACE NUMERICAL TOTAL trevor Excel Discussion (Misc queries) 3 May 1st 08 05:56 PM
Excel 2002 : Any single button to get sub total and grand total ? Mr. Low Excel Discussion (Misc queries) 2 May 22nd 07 08:46 AM
find and replace - replace data in rows to separated by commas msdker Excel Worksheet Functions 1 April 15th 06 01:00 AM
Adding Data Using Multiple Worksheets to Total into a Grand Total Lillie Excel Worksheet Functions 1 April 19th 05 08:34 PM


All times are GMT +1. The time now is 11:32 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"