Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Quick string thing!!!!

Hi,

In my excel sheet I have data such as :

MAC-103-234-234
MAC-103-234-234
MAC-103-234-234
MAC-103-234-234

I need to delete all the "-" and leave:

MAC103234234
MAC103234234
MAC103234234
MAC103234234

Any suggestions??

Cheers

Manny
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Quick string thing!!!!

select the column and do

Edit=Replace
What -
With leave blank

--
Regards,
Tom Ogilvy

"Mannyluk" wrote in message
...
Hi,

In my excel sheet I have data such as :

MAC-103-234-234
MAC-103-234-234
MAC-103-234-234
MAC-103-234-234

I need to delete all the "-" and leave:

MAC103234234
MAC103234234
MAC103234234
MAC103234234

Any suggestions??

Cheers

Manny



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Quick string thing!!!!

Needs to be done in a macro.

But thanks anyway

"Tom Ogilvy" wrote:

select the column and do

Edit=Replace
What -
With leave blank

--
Regards,
Tom Ogilvy

"Mannyluk" wrote in message
...
Hi,

In my excel sheet I have data such as :

MAC-103-234-234
MAC-103-234-234
MAC-103-234-234
MAC-103-234-234

I need to delete all the "-" and leave:

MAC103234234
MAC103234234
MAC103234234
MAC103234234

Any suggestions??

Cheers

Manny




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Quick string thing!!!!


The code would be:

Sub Test()

For Each r In Range("A1:A4")

r.Value = Replace(r.Value, "-", "")

Next

End Sub

Substitute your a range for A1:A4.



--
kkkni
-----------------------------------------------------------------------
kkknie's Profile: http://www.excelforum.com/member.php...nfo&userid=754
View this thread: http://www.excelforum.com/showthread.php?threadid=27081

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Quick string thing!!!!

Just turn on the macro recorder while you do it manually.

It is a single command.

What could be simpler.

Here, I will do it for you:

Sub ReplaceHyphen()
Columns(1).Replace What:="-", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False

End Sub

--
Regards,
Tom Ogilvy






"Mannyluk" wrote in message
...
Needs to be done in a macro.

But thanks anyway

"Tom Ogilvy" wrote:

select the column and do

Edit=Replace
What -
With leave blank

--
Regards,
Tom Ogilvy

"Mannyluk" wrote in message
...
Hi,

In my excel sheet I have data such as :

MAC-103-234-234
MAC-103-234-234
MAC-103-234-234
MAC-103-234-234

I need to delete all the "-" and leave:

MAC103234234
MAC103234234
MAC103234234
MAC103234234

Any suggestions??

Cheers

Manny








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Quick string thing!!!!

Just a thought since you said nothing but "the code would be", then
presented a different approach than what was suggest by me.

Using the Replace Method without looping would be much faster than using the
replace function in a loop. For 4 cells, it wouldn't be noticeable, but for
1000 (for example) it would.

--
Regards,
Tom Ogilvy

"kkknie" wrote in message
...

The code would be:

Sub Test()

For Each r In Range("A1:A4")

r.Value = Replace(r.Value, "-", "")

Next

End Sub

Substitute your a range for A1:A4.

K


--
kkknie
------------------------------------------------------------------------
kkknie's Profile:

http://www.excelforum.com/member.php...fo&userid=7543
View this thread: http://www.excelforum.com/showthread...hreadid=270816



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Quick string thing!!!!

"Mannyluk" wrote in message ...
Hi,

In my excel sheet I have data such as :

MAC-103-234-234
MAC-103-234-234
MAC-103-234-234
MAC-103-234-234

I need to delete all the "-" and leave:

MAC103234234
MAC103234234
MAC103234234
MAC103234234

Any suggestions??

Cheers

Manny


This will select the entire current region and remove all -. If you
want to do it by a column use Columns("A:A").Select instead of
Selection.CurrentRegion.Select.

Fred

------
Sub remove_hyphen()
Selection.CurrentRegion.Select
Selection.Replace What:="-", Replacement:="", LookAt:=xlPart,
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False,
ReplaceFormat:=False
End Sub
-------
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Quick string thing!!!!

"Mannyluk" wrote in message ...
Hi,

In my excel sheet I have data such as :

MAC-103-234-234
MAC-103-234-234
MAC-103-234-234
MAC-103-234-234

I need to delete all the "-" and leave:

MAC103234234
MAC103234234
MAC103234234
MAC103234234

Any suggestions??

Cheers

Manny


Actually all you need is this:

-----
Sub remove_hyphen()
Selection.CurrentRegion.Select
Selection.Replace What:="-", Replacement:=""
End Sub
------

TIP: What I did was record a Macro doing it manually like Tom
reccomended. Then just cleaned up the code.

Fred
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Quick string thing!!!!


Tom,

You are 100% correct. When I wrote "The code would be", I should hav
said "a code that will work but may not be the best possible would be"
Much appologies.

K

P.S. Thank you for the denigration

--
kkkni
-----------------------------------------------------------------------
kkknie's Profile: http://www.excelforum.com/member.php...nfo&userid=754
View this thread: http://www.excelforum.com/showthread.php?threadid=27081

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
One Last Thing Coltsfan Excel Discussion (Misc queries) 1 January 16th 06 08:42 PM
one more thing Bompi Excel Worksheet Functions 1 January 11th 05 08:09 PM
Doing it's own thing André Excel Programming 3 July 9th 04 11:30 PM
Another thing Richard Excel Programming 0 May 21st 04 04:21 PM
oh, and another thing ted daniels Excel Programming 2 April 22nd 04 05:34 PM


All times are GMT +1. The time now is 06:32 PM.

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

About Us

"It's about Microsoft Excel"