Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default 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
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
fields names do not show in excel 2007 pivot table fields list marlo17 New Users to Excel 2 December 1st 08 01:25 PM
Appending data from two sheets according to like fields Dennis P in GI Excel Discussion (Misc queries) 1 August 30th 08 06:28 PM
appending fields from another spreadsheet eliyahuz Excel Discussion (Misc queries) 3 November 5th 07 11:42 PM
Excel SHOULD NOT AUTO-CHANGE formated text fields to DATE FIELDS! PSSSD Excel Worksheet Functions 2 August 8th 06 09:31 PM
Catalogue of fields' connection whit external fields ( sheets) Nicola Bianchi Excel Programming 0 September 27th 03 10:42 AM


All times are GMT +1. The time now is 05:22 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"