Sub rearranecolumnsSAS()
Dim lr As Long
Dim i As Long
Dim dlr As Long

lr = Cells(Rows.Count, 1).End(xlUp).Row
For i = 3 To Cells(1, Columns.Count).End(xlToLeft).Column
dlr = Cells(Rows.Count, 1).End(xlUp).Row + 1
Cells(2, 1).Resize(lr - 1).Copy Cells(dlr, 1)
Cells(1, i).Copy Cells(dlr, 3).Resize(lr - 1)
Cells(2, i).Resize(lr).Copy Cells(dlr, 4)
Next i
Rows(2).Resize(lr - 1).Delete
End Sub

Don Guillett
Microsoft Excel Developer
SalesAid Software
dguille...@gmail.com

From: Amol J 
Sent: Sunday, August 19, 2012 10:41 PM
To: excel-macros@googlegroups.com 
Subject: $$Excel-Macros$$ Need help on macro Re-organize data from a 2 
dimensional grid to a single dimensional grid

Hi Experts
I need macro to do the following thing, 
a. Re-organize data from a 2 dimensional grid to a single dimensional grid - 
see example below

source data:
Item  Sales MH, GJ, KA
A                 1     2    3
B                 4     5    6
C                 7     8    9

reformat to the following
Item STATE Sales
A         MH      1
B         MH      4
C         MH      7
A         GJ       2
B         GJ       5
C         GJ       8
A         KA      3
B         KA      6
C         KA      9


Please help me on this problem.

Thanks,
Amol J



-- 
Join official facebook page of this forum @ 
https://www.facebook.com/discussexcel
 
FORUM RULES (1120+ members already BANNED for violation)
 
1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
 
2) Don't post a question in the thread of another member.
 
3) Don't post questions regarding breaking or bypassing any security measure.
 
4) Acknowledge the responses you receive, good or bad.
 
5) Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 
 
6) Jobs posting is not allowed.
 
7) Sharing copyrighted ebooks/pirated ebooks/their links is not allowed.
 
NOTE : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To post to this group, send email to excel-macros@googlegroups.com.
To unsubscribe from this group, send email to 
excel-macros+unsubscr...@googlegroups.com.
 
 

-- 
Join official facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES (1120+ members already BANNED for violation)

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.

2) Don't post a question in the thread of another member.

3) Don't post questions regarding breaking or bypassing any security measure.

4) Acknowledge the responses you receive, good or bad.

5)  Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

6) Jobs posting is not allowed.

7) Sharing copyrighted ebooks/pirated ebooks/their links is not allowed.

NOTE  : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To post to this group, send email to excel-macros@googlegroups.com.
To unsubscribe from this group, send email to 
excel-macros+unsubscr...@googlegroups.com.


Reply via email to