Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Appending to fields
I have a 400 row column called zipcode. Obviously, it contains 400
different zipcodes. For each record, I need to append or concatenate some punctuation to it. Zipcodes look like this 12345, I want each one to look like '12345', That is, adding paranthesis around the number, and a comma after each number. Any easy way to do this? Thanks for the help! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Appending to fields
Sub AlterZip()
Dim c As Range Dim zip As Range Dim a As String 'leading puctuation Dim b As String ' trailing puctuation Dim x As String ' current zip value Set zip = Worksheets("Sheet1").Range("A1:A400") 'change to fit your location a = "''" b = "'," For Each c In zip x = c.Value c.Value = a + x + b Next c End Sub Note: a = "''" is two apostrophes enlosed in quotes.[" ' ' "] The first apostophe will make the cell text and will not be displayed. Mike F "Amon Borland" wrote in message ... I have a 400 row column called zipcode. Obviously, it contains 400 different zipcodes. For each record, I need to append or concatenate some punctuation to it. Zipcodes look like this 12345, I want each one to look like '12345', That is, adding paranthesis around the number, and a comma after each number. Any easy way to do this? Thanks for the help! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
fields names do not show in excel 2007 pivot table fields list | New Users to Excel | |||
Appending data from two sheets according to like fields | Excel Discussion (Misc queries) | |||
appending fields from another spreadsheet | Excel Discussion (Misc queries) | |||
Excel SHOULD NOT AUTO-CHANGE formated text fields to DATE FIELDS! | Excel Worksheet Functions | |||
Catalogue of fields' connection whit external fields ( sheets) | Excel Programming |