Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Splitting up address

How would I write a macro that would split up an addrss by spaces? Lets say
the address is 1364 W elm street apt #4? I am new to coding so I dont know
where to start. Also I need the macro to run down the list until there is no
address to move.
Any help would be greatly appreciated, thanks Neal.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Splitting up address

I suggest you start by recording a macro of you using the text to
columns function and using a space as your delimitor.

From there you can see the code and play with it from there.


Neal wrote:
How would I write a macro that would split up an addrss by spaces? Lets say
the address is 1364 W elm street apt #4? I am new to coding so I dont know
where to start. Also I need the macro to run down the list until there is no
address to move.
Any help would be greatly appreciated, thanks Neal.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 695
Default Splitting up address

or try this 1 i got from mr. bak

Sub test()
Dim rCell As Range
For Each rCell In Selection
rCell(1, 2).Resize(, 6) = Split(rCell, " ")
Next
End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 695
Default Splitting up address

remember select ur adress cells, - and run kode

" skrev:

I suggest you start by recording a macro of you using the text to
columns function and using a space as your delimitor.

From there you can see the code and play with it from there.


Neal wrote:
How would I write a macro that would split up an addrss by spaces? Lets say
the address is 1364 W elm street apt #4? I am new to coding so I dont know
where to start. Also I need the macro to run down the list until there is no
address to move.
Any help would be greatly appreciated, thanks Neal.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Splitting up address

Thank you it works great.

"excelent" wrote:

remember select ur adress cells, - and run kode

" skrev:

I suggest you start by recording a macro of you using the text to
columns function and using a space as your delimitor.

From there you can see the code and play with it from there.


Neal wrote:
How would I write a macro that would split up an addrss by spaces? Lets say
the address is 1364 W elm street apt #4? I am new to coding so I dont know
where to start. Also I need the macro to run down the list until there is no
address to move.
Any help would be greatly appreciated, thanks Neal.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Splitting up address

How do I avoid getting a null value in the remainding cells. Not every
address will have 6 cells to populate?Is there a way to write it out to stop
after it hits a blank spot?

"excelent" wrote:

remember select ur adress cells, - and run kode

" skrev:

I suggest you start by recording a macro of you using the text to
columns function and using a space as your delimitor.

From there you can see the code and play with it from there.


Neal wrote:
How would I write a macro that would split up an addrss by spaces? Lets say
the address is 1364 W elm street apt #4? I am new to coding so I dont know
where to start. Also I need the macro to run down the list until there is no
address to move.
Any help would be greatly appreciated, thanks Neal.



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 695
Default Splitting up address

Sub test()
Dim c, cCount
Dim rCell As Range
For Each rCell In Selection
For c = 1 To Len(rCell)
If Mid(rCell, c, 1) = " " Then cCount = cCount + 1
Next
rCell(1, 2).Resize(, cCount + 1) = Split(rCell, " "): cCount = 0
Next
End Sub

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Splitting up address

This worked great. I had one question about assigning a range. Would i enter
it under the dim rcell as range, and would it be range("A1").select? Thanks
for the help.

"excelent" wrote:

Sub test()
Dim c, cCount
Dim rCell As Range
For Each rCell In Selection
For c = 1 To Len(rCell)
If Mid(rCell, c, 1) = " " Then cCount = cCount + 1
Next
rCell(1, 2).Resize(, cCount + 1) = Split(rCell, " "): cCount = 0
Next
End Sub

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
Splitting up address John Excel Discussion (Misc queries) 3 June 30th 08 02:13 PM
Splitting Address Info - Text to Columns betany70 Excel Discussion (Misc queries) 4 October 12th 07 09:54 PM
Splitting Numeric data from Text (Street Address Help) Cameron Excel Discussion (Misc queries) 2 December 5th 06 10:18 PM
Splitting comma separated lines of an address for mail merge. Chuda Excel Discussion (Misc queries) 1 September 12th 06 01:04 PM
LINKING Address cells from an EXCEL spreadsheet to fill MapQuest Address Info Duane S. Meyer Excel Programming 0 August 30th 03 12:16 AM


All times are GMT +1. The time now is 09:20 AM.

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

About Us

"It's about Microsoft Excel"