![]() |
| |||||||
| Sponsored Links |
![]() | « Previous Thread | Next Thread » |
| | LinkBack | Thread Tools | Display Modes |
|
#1
| |||
| |||
| Good morning everyone its peeb, i'm really not familiar with doing macros, especially in excel. I have friend that is working on an excel sheet that will be imported into access. She has like over 100 + zipcodes that she has entered into 1 cell in excel. Well she need to put a comma between the spaces of each zipcode. This is her first time working with a macro, I told I would see what I can research on it. I"m not finding much online except for http://www.mrexcel.com/forum/showthread.php?p=1543776 Unfortantly I don't fully understand it, but I really have not sat an analized the code. I'm sure If I did with time i would. Anyway does anyone know of like a simple macro snippet that can search a cell for spaces and insert a comma in between the spaces of zip codes. (e.g., 44444, 44444, 44444) I appreciate any suggestions, thanks. Last edited by peebman2000; August 27th, 2008 at 09:18 AM. Reason: missed word |
| Sponsored Links |
|
#2
| ||||
| ||||
| Try a function like this:- Code: Function add_comma(cell_value As String) As String add_comma = Replace(cell_value," ",", ") End Function Then in a seperate cell on the spreadsheet have Code: =add_comma(A1) Hope that helps. |
| The Following User Says Thank You to richyrich For This Useful Post: | ||
peebman2000 (August 27th, 2008) | ||
|
#3
| |||
| |||
| Hey Richy, thanks for the help. I just tried it in excel and the code works perfectly. I just forwarded my friend this link with the code for her to use and told her to call me if she needs help on it. But thanks again dude I appreciate the reply. Have a good day. Quote:
|
|
#4
| ||||
| ||||
| Quote:
|
|
#5
| |||
| |||
| Hey Rich got another question. I worked with my friend yesterday on the excel macro and it worked thanks to your idea. But she also has zipcodes that have breaks (vbCrLf) see exampleL 55555 45666 57555 I tried playing with your VBA code below to see if I could get it to replace line breaks with commas. Code: Function add_comma(cell_value As String) As String add_comma = Replace(cell_value,"vbCrlf ",", ") End Function |
|
#6
| ||||
| ||||
| I presume she has used Alt+Enter to put in each line. In which case, try this:- Code: Function add_comma(cell_value As String) As String
add_comma = Replace(cell_value, Chr(10), ", ")
End Function
Hope that helps. |
| The Following User Says Thank You to richyrich For This Useful Post: | ||
peebman2000 (August 28th, 2008) | ||
|
#7
| |||
| |||
| Thanks again rich that worked, I just tried in excel and it worked. My friend is working on it now. Thanks again for the help. |
![]() |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| From excel to database/web app | Rebelle | Database Design Help | 7 | July 10th, 2008 01:36 PM |
| find words and change | todd2006 | JavaScript Programming | 4 | July 2nd, 2008 09:58 AM |
| Excel question | Rebelle | Microsoft Office | 11 | May 27th, 2008 07:22 PM |
| Retrieving Web Data using Excel | mehere | Microsoft Office | 13 | May 22nd, 2008 03:14 PM |