Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Do I need a Macro to do Transpose in this case?

I have worksheets with column A showing account number, with multiple phone
numbers associated to this account in a comment bubble, coulumn B showing the
carrier name.
What I am trying to do is to get these data into 3 columns, one row for each
phone number depending on how many records in each comment, also with
repeating account and carrier description for example:

Account number phone number carrier
12345 123-123-1234 AT&T
12345 123-234-2345 AT&T
12345 234-334-3345 AT&T

I had tried copy phone nubmers from comment to column C, then do Text to
Column, and TRANSPOSE but this will take a year for me to finishe all the
worksheets. I am hoping there are some easier way to do this...

Help !
And thanks in advance!!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,441
Default Do I need a Macro to do Transpose in this case?

Ting,

Yes, you need a macro.

Select the cells in column A, and run the macro below. Try it on a copy of your data first, to make
sure it works....

HTH,
Bernie
MS Excel MVP

Sub TryNow()
Dim myC As Range
Dim myCom As String
Dim myComs As Variant
Dim i As Integer
Dim myR As Long
Dim myS As Range

Set myS = Selection
On Error GoTo noComment
myS.Offset(0, 1).EntireColumn.Insert
For myR = myS.Cells.Count To 1 Step -1
With myS.Cells(myR)
myCom = .Comment.Text
.Comment.Delete
myComs = Split(myCom, Chr(10))
.Offset(1).Resize(UBound(myComs), 3).Insert
.Resize(1, 3).Copy .Offset(1).Resize(UBound(myComs) - LBound(myComs), 3)
For i = 0 To UBound(myComs)
.Offset(i, 1).Value = myComs(i)
Next i
End With
GoTo skip
noComment:
Resume TryAgain
TryAgain:
On Error GoTo noComment
skip:
Next myR
End Sub

"Ting" wrote in message
...
I have worksheets with column A showing account number, with multiple phone
numbers associated to this account in a comment bubble, coulumn B showing the
carrier name.
What I am trying to do is to get these data into 3 columns, one row for each
phone number depending on how many records in each comment, also with
repeating account and carrier description for example:

Account number phone number carrier
12345 123-123-1234 AT&T
12345 123-234-2345 AT&T
12345 234-334-3345 AT&T

I had tried copy phone nubmers from comment to column C, then do Text to
Column, and TRANSPOSE but this will take a year for me to finishe all the
worksheets. I am hoping there are some easier way to do this...

Help !
And thanks in advance!!



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Do I need a Macro to do Transpose in this case?

OH MY GOD !

Is this a magic or what?!!
You save my day(s)!

Thanks you very so much!!! Bernie


"Bernie Deitrick" wrote:

Ting,

Yes, you need a macro.

Select the cells in column A, and run the macro below. Try it on a copy of your data first, to make
sure it works....

HTH,
Bernie
MS Excel MVP

Sub TryNow()
Dim myC As Range
Dim myCom As String
Dim myComs As Variant
Dim i As Integer
Dim myR As Long
Dim myS As Range

Set myS = Selection
On Error GoTo noComment
myS.Offset(0, 1).EntireColumn.Insert
For myR = myS.Cells.Count To 1 Step -1
With myS.Cells(myR)
myCom = .Comment.Text
.Comment.Delete
myComs = Split(myCom, Chr(10))
.Offset(1).Resize(UBound(myComs), 3).Insert
.Resize(1, 3).Copy .Offset(1).Resize(UBound(myComs) - LBound(myComs), 3)
For i = 0 To UBound(myComs)
.Offset(i, 1).Value = myComs(i)
Next i
End With
GoTo skip
noComment:
Resume TryAgain
TryAgain:
On Error GoTo noComment
skip:
Next myR
End Sub

"Ting" wrote in message
...
I have worksheets with column A showing account number, with multiple phone
numbers associated to this account in a comment bubble, coulumn B showing the
carrier name.
What I am trying to do is to get these data into 3 columns, one row for each
phone number depending on how many records in each comment, also with
repeating account and carrier description for example:

Account number phone number carrier
12345 123-123-1234 AT&T
12345 123-234-2345 AT&T
12345 234-334-3345 AT&T

I had tried copy phone nubmers from comment to column C, then do Text to
Column, and TRANSPOSE but this will take a year for me to finishe all the
worksheets. I am hoping there are some easier way to do this...

Help !
And thanks in advance!!




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,441
Default Do I need a Macro to do Transpose in this case?

Yes, it is magic... and a lucky guess that you were using a return between numbers... ;-)

Thanks for letting me know that it worked for you - always nice to get positive feedback.

Bernie
MS Excel MVP


OH MY GOD !

Is this a magic or what?!!
You save my day(s)!

Thanks you very so much!!! Bernie



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
how to create a copy/paste special/transpose macro? [email protected] Excel Discussion (Misc queries) 6 August 8th 07 06:07 AM
I need a macro to transpose multiple columns A1-Z1, A2-X2 etc Wombat62 Excel Discussion (Misc queries) 7 September 18th 06 05:05 AM
Macro for proper case Tania Excel Discussion (Misc queries) 5 January 25th 06 03:55 PM
Transpose Macro Spil Excel Worksheet Functions 1 July 14th 05 09:28 AM
Transpose date macro Henry Lifton Excel Worksheet Functions 2 March 16th 05 06:12 PM


All times are GMT +1. The time now is 03:48 PM.

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"