MrExcel Publishing
Your One Stop for Excel Tips & Solutions

I STILL NEED HELP!!! -(simple macro in excel prob)

Posted by Lucy Harris on September 26, 2000 7:39 AM

I have a colum of postcodes (5000) and need to run a simple macro to delete all but the first two letters
E.g. DE7 6EF - becomes DE
Davids answer didnt seem to work - but i am a novice , I just deleted a macro I tried to record and wrote in his answer but when I ran it all that happend was the egg timer flashed rapidly, kinda cool but of no use! I would be very greatful if one of you PRO's could help silly ol' me.
Thanks alot
Lucy **

Posted by Celia on September 26, 2000 8:51 AM

Select your data then run this :-

Sub hello()
Dim cell As Range
For Each cell In Selection
cell.Value = Left(cell.Value, 2)
End Sub

It can also be done without a macro :-
1.Let's say your data is in column A.
2.Insert a column to the right of column A.
3.Enter the following formula in the first cell of this new column :-
4.Fill the formula down as far as required.
5.Delete column A.


Posted by Loren on September 26, 2000 9:06 AM

-(simple macro in excel prob)

Do Not Delete col. A until you have converted
your formulas to hard numbers.

Posted by Celia on September 26, 2000 9:09 AM

Re: -(simple macro in excel prob)

Quite right! Thanks Loren

Posted by ori yovel on October 30, 2000 7:34 AM

universal macro

i would like to know how can i
make the same macro work for
different excel files?