Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / April 2004

Tip: Looking for answers? Try searching our database.

Moving data across columns

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
amonroe - 14 Apr 2004 19:19 GMT
Hello Everyone,

I hope someone can help me. I have a file containig contact informatio
with all the data in column 1 i.e. name in cell A:1, complete addres
in cell A:2, phone number in cell A:3.

I need the data in a database format i.e. name in A:1, address in B:1
city in C:1, zip in D:1 and phone in E:1. I have about 1,500 files s
the Macro would have to move down and repeat the process.

Also, since A:2 contains the full address, the macro should also brea
apart this information so that the city, state and zip is in its ow
field.

I may need two separate macros to accomplish this. Does anyone have an
suggestions as to how I would go about accomplishing this task?

Thank you in advance.

A

--
Message posted from http://www.ExcelForum.com
Gord Dibben - 14 Apr 2004 19:59 GMT
AM

If your data is consistent...X number of rows each, this macro will transpose
to columns.

Then you'll have to deal with splitting the full addresses up into 3 columns
using Data>Text to Columns on Column B.  Your data format will dictate what
you use......de-limited or fixed width.

Sub ColtoRows()
   Dim Rng As Range
   Dim i As Long
   Dim j As Long
   Dim nocols As Integer

   Set Rng = Cells(Rows.Count, 1).End(xlUp)
   j = 1
  On Error Resume Next
  nocols = InputBox("Enter Number of Columns Desired")
'3 in your example
       For i = 1 To Rng.Row Step nocols
       Cells(j, "A").Resize(1, nocols).Value = _
               Application.Transpose(Cells(i, "A").Resize(nocols, 1))
       j = j + 1
   Next
   Range(Cells(j, "A"), Cells(Rng.Row, "A")).ClearContents

End Sub

Gord Dibben Excel MVP

>Hello Everyone,
>
[quoted text clipped - 19 lines]
>---
>Message posted from http://www.ExcelForum.com/
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.