vba courses london - seperating text strings one
Microsoft Office Training verified by visa - mastercard securecode about microsoft training company london ukadd this page to your favourites/bookmarksAdd to favourites
view a printable version of this pagePrintable version
email this page to somebodyEmail this page
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft VBA Training and help » vba courses london - Seperating text strings from one to two columns

vba courses london - Seperating text strings from one to two columns

The UK's most regular instructor-led training courses.
Training information: vba courses london · Excel london

resolvedResolved · Low Priority · Version Standard

Seperating text strings from one to two columns

Claire has attended:
No courses

by - delegate Claire [1 post] (2007 Feb 15 Thu, 11:38) replyReply

I have been asked to write a macro to split address data entered in one column into two, with the house name/number and street in one column, and the town in another. Postcode not included. How can I do this?

RE: seperating text strings from one to two columns

by - trainer Garry gold contributer[188 posts] (2007 Feb 15 Thu, 13:30) replyReply

did you know there is actually a function for this: for example

lets say you have a database of 4000 songs all in column A.

ie, animals - house of the rising sun

you wanted to replace the hyphens for a column.

Denis replied with this solution

Highlight all of your cells with the data.


Select the topmost cell in the column, e.g. A1
Hold CTRL+SHIFT and then press the down arrow.
OK, once we've done that, go to "Data" menu and select "Text To Columns".
On the Text To Columns window, select "Delimited" and then hit "Next".
In the following window, choose "other" for type of delimiter and use the minus/hyphen sign -
Hit Finish.

Now you will have two columns, from your example, the first column will contain data like "Animals" and the other column will contain the data " House of The Rising Sun". (note the SPACE in front of "House")

To get rid of that SPACE we're going to use the TRIM function.

In cell C1 (or the column to the right of the song titles) type in this formula.

=TRIM(B1)

Then double-click on that little black box on the excel cursor to copy the formula down the whole range. Any spaces at the start or end of the text string will be removed.



Related articles

· What Is Microsoft Excel VBA and How Can It Help You Work Smarter?
· Company Roles in Visual Basic Training

Vba tip:

Stuck in a Code Loop

If you ever get stuck in an infinite code loop when programing in VBA use

CTRL+BREAK

to exit the procedure

View all VBA hints and tips

Institute of IT Training - Accredited Training Provider Microsoft Certified Partner
microsoft office
Microsoft Office Specialist Authorised Testing Centre (MOS and MCAS)

Prodigy Platinum Learning Partner

Institute of IT Training - Accredited Training Provider Association of Computer Trainers Valid HTML 4.01 Transitional
Valid CSS Markup

secure online payments - visa - mastercard

Mini sitemap. These are the main areas of our web site. Full sitemap.

Training by application Main information pages See also

Access courses
DreamWeaver courses
Excel courses
MS Project courses
Outlook courses
PowerPoint courses
VBA courses
Word courses
(more...)

Public scheduled courses
On-site training
Closed company courses

Microsoft Office training
Pricing and availability
Training schedule
Training venues

Access training
Dreamweaver training
Excel training
MS Project training
PowerPoint training

London Computer Training
Computer Training London

Microsoft Access training
Microsoft Excel training
Microsoft Project training
Microsoft Outlook training
Microsoft Powerpoint training
Microsoft Word training

Time Management Course London

Interested in Access training? Please see the following pages:
microsoft access courses · microsoft training access course
microsoft+access+training · access courses in london

Training Information
AddThis Social Bookmark Button What's this?
Add to Del.icio.us Add to Facebook Add to Digg Add to Reddit Add to Google Add to Yahoo Add to Diigo Add to Mr. Wong Add to Linkarena Add to Power Oldie Add to Folkd Add to Jumptags Add to Upchuckr Add to Simpy Add to StumbleUpon Add to Slashdot Add to Netscape Add to Furl Add to Spurl Add to Blinklist Add to Blogmarks Add to Technorati Add to Newsvine Add to Blinkbits Add to Ma.Gnolia Add to Smarking Add to Netvouz