Thread: How do I
View Single Post
  #13   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default

On Mon, 6 Dec 2004 11:36:52 -0000, "Dark Horse"
wrote:

and where do I enter this, and how?
I'm an almost complete beginner, and some of the solutions offered seem to
be taking longer than doing it by hand - and are far more complicated.

You can enter it in some blank column in the same first row as your data. Then
copy/drag the formula down so the cell reference will change appropriately.

Substitute for A1 the first cell of your data.

Then you can either use this new column for the source of your now corrected
data, or you can copy it (Edit/Copy) and do a Edit/Paste Special/ Values over
the original data.

Another method would be to use a VBA macro.

Right click on the sheet tab and select View Code.
From the VB Editor main menu, select Insert/Module and paste the code below
into the window that opens.

On your worksheet, select the range of data to modify.
<alt-F8 and select the name of the macro; then Run.

This code perhaps has an advantage of not removing extra spaces that are WITHIN
the name, although it will remove both leading and trailing spaces.

======================================
Sub TrimCountry()
Dim c As Range
For Each c In Selection
If InStr(c.Text, " (") 0 Then
c = Left(c.Text, InStr(c.Text, " ("))
c = RTrim(LTrim(c.Text))
End If
Next c
End Sub
=======================


--ron