Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,071
Default HELP!!

Mac
Here is a macro that will do what you want. I assumed that the sheet that
holds the data is named "Start" and the sheet that will get the final
product is named "Finish". Change these in the code as you need to.
I had a bit of difficulty because I didn't know how to extract the account
number from the real headers that you have. Looking at what you gave me,
headers like "Acct no 1025", "Acct 1040", etc. I wrote this macro to take
the last 4 characters of those headers and use that as the account number in
the final product. Think about this and see if that fits with your data.
Let me know what changes you need to have made. Otto
Sub ReArrangeData()
Dim rColA As Range
Dim i As Range
Dim j As Range
Dim Dest As Range
Dim rRowi As Range
Application.ScreenUpdating = False
Sheets("Start").Select
Set rColA = Range("A2", Range("A" & Rows.Count).End(xlUp))
Set Dest = Sheets("Finish").Range("A2")
For Each i In rColA
Set rRowi = Range(Cells(i.Row, 2), Cells(i.Row,
Columns.Count).End(xlToLeft))
For Each j In rRowi
Dest.Value = i.Value
Dest.Offset(, 1).Value = Right(Cells(1, j.Column).Value,
4)
Dest.Offset(, 2).Value = j.Value
Set Dest = Dest.Offset(1)
Next j
Next i
Application.ScreenUpdating = True
End Sub
"Mac" wrote in message
...
Thank you for answering my query.
My worksheet is set up like this.
id acct no 1025 acctno 1030 acct 1040 acct 1050
1234 1500 2500 3600 4000
2345 5000 5000 5000 5000

i want to have it look like this
id acct amount
1234 1025 1500
2345 1025 5000
1234 2500 2500
1234 1040 3600
1050 1050 4000

I have about 250 rows of data and up to 200 columns of data
Can you help.
Thank you!!!!

"Otto Moehrbach" wrote:

It's easy to do what you want, I think, but I don't know what you have
nor
what you want to have. Your explanation of what you have is not clear.
Is
it that you have repeating columns of 3 and you want all of the data put
into 3 columns total? Post back and provide some examples of what you
have.
HTH Otto














"Mac" wrote in message
...
I need help. i have a worksheet that is set up in columns like:
id acct no amount
I have 250 rows of data and a lots of columns
Whiat I would like to do is set it up so that the rows look like this
id account amount
for all.
is there a way to do a macro that will take all the data by column and
move
it to a row and continue without overwriting the data?

Any help will be greatly appreciated








 
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



All times are GMT +1. The time now is 12:27 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"