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


Hi,

I've got some data which i imported from a text file
The data constains company names adrresses and telephone numbers
Now the problem is, in the text file some of the semicolons are in th
wrong place.
When i import it into excel i want to move the semicolon so that space
belongs where they must, example

imported into excel: (Semicolon where space should be)
TFS Securities (Pty) Ltd;Sandton;Gauteng;011 465 3686
Vector Equities (Pty) Ltd;Cape*;*Town;Western Cape;021 419 3992
Watermark Securities (Pty) Ltd;Hyde*;*Park;Gauteng;011 325 4228
Cazenove South Africa (Pty) Ltd;Dunkeld;West*;*Gauteng;011 280 7900

The first one is correct but the last 3 needs changing:
Vector Equities (Pty) Ltd;Cape Town;Western Cape;021 419 3992
Watermark Securities (Pty) Ltd;Hyde Park;Gauteng;011 325 4228
Cazenove South Africa (Pty) Ltd;Dunkeld;West Gauteng;011 280 7900

As you can see this is a dillemma.
I'm trying to automate the change with a macro, but some of the length
clash and then i had a space where it doesnt belong.
I would appreciate the help.
Thanks in advance.
Pete

--
MavRi
-----------------------------------------------------------------------
MavRiK's Profile: http://www.excelforum.com/member.php...fo&userid=1472
View this thread: http://www.excelforum.com/showthread.php?threadid=26504

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Semicolon problem

Sub ReplaceData()
Cells.Replace What:="~*;~*", _
Replacement:=" ", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
End sub

Test it on a copy of your data.

--
Regards,
Tom Ogilvy


"MavRiK" wrote in message
...

Hi,

I've got some data which i imported from a text file
The data constains company names adrresses and telephone numbers
Now the problem is, in the text file some of the semicolons are in the
wrong place.
When i import it into excel i want to move the semicolon so that spaces
belongs where they must, example

imported into excel: (Semicolon where space should be)
TFS Securities (Pty) Ltd;Sandton;Gauteng;011 465 3686
Vector Equities (Pty) Ltd;Cape*;*Town;Western Cape;021 419 3992
Watermark Securities (Pty) Ltd;Hyde*;*Park;Gauteng;011 325 4228
Cazenove South Africa (Pty) Ltd;Dunkeld;West*;*Gauteng;011 280 7900

The first one is correct but the last 3 needs changing:
Vector Equities (Pty) Ltd;Cape Town;Western Cape;021 419 3992
Watermark Securities (Pty) Ltd;Hyde Park;Gauteng;011 325 4228
Cazenove South Africa (Pty) Ltd;Dunkeld;West Gauteng;011 280 7900

As you can see this is a dillemma.
I'm trying to automate the change with a macro, but some of the lengths
clash and then i had a space where it doesnt belong.
I would appreciate the help.
Thanks in advance.
Peter


--
MavRiK
------------------------------------------------------------------------
MavRiK's Profile:

http://www.excelforum.com/member.php...o&userid=14728
View this thread: http://www.excelforum.com/showthread...hreadid=265047



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Semicolon problem

From your sample, it looks like you always have a "*;*"
where you want only a ";". I would do a search and
replace on the original text file (or on a copy of it)
before the import to Excel using the ";" as the separator
character.

It may be worth trying to determine why the system that is
producing this text file is adding those extra characters.

Hope this helps.


-----Original Message-----

Hi,

I've got some data which i imported from a text file
The data constains company names adrresses and telephone

numbers
Now the problem is, in the text file some of the

semicolons are in the
wrong place.
When i import it into excel i want to move the semicolon

so that spaces
belongs where they must, example

imported into excel: (Semicolon where space should be)
TFS Securities (Pty) Ltd;Sandton;Gauteng;011 465 3686
Vector Equities (Pty) Ltd;Cape*;*Town;Western Cape;021

419 3992
Watermark Securities (Pty) Ltd;Hyde*;*Park;Gauteng;011

325 4228
Cazenove South Africa (Pty)

Ltd;Dunkeld;West*;*Gauteng;011 280 7900

The first one is correct but the last 3 needs changing:
Vector Equities (Pty) Ltd;Cape Town;Western Cape;021 419

3992
Watermark Securities (Pty) Ltd;Hyde Park;Gauteng;011 325

4228
Cazenove South Africa (Pty) Ltd;Dunkeld;West Gauteng;011

280 7900

As you can see this is a dillemma.
I'm trying to automate the change with a macro, but some

of the lengths
clash and then i had a space where it doesnt belong.
I would appreciate the help.
Thanks in advance.
Peter


--
MavRiK
----------------------------------------------------------

--------------
MavRiK's Profile: http://www.excelforum.com/member.php?

action=getinfo&userid=14728
View this thread:

http://www.excelforum.com/showthread...hreadid=265047

.

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
How can I add a semicolon at the end of a name in 400 rows at once mike Excel Discussion (Misc queries) 3 July 15th 11 03:12 PM
adding a semicolon RaY New Users to Excel 3 January 3rd 09 04:53 AM
Adding a semicolon to the end of a name [email protected] Excel Discussion (Misc queries) 2 December 15th 08 04:12 PM
SUMPRODUCT --- semicolon (;) vs. plus sign (+) Epinn Excel Worksheet Functions 5 September 28th 06 04:03 PM
how do i make a semicolon appear in every cell Paul Excel Discussion (Misc queries) 2 August 10th 06 10:53 PM


All times are GMT +1. The time now is 04:17 AM.

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"