Change from Horizontal Multiples to Vertical Multiples

callmeshirley

New Member
Joined
Mar 24, 2009
Messages
5
I have these numbers:
Billy 10 15 24
Sally 18 10 6
Ahmad 30 2 18

& I need them formatted as so:

Billy 10
Billy 15
Billy 24
Sally 18
Sally 10
Sally 6
Ahmad 30
Ahmad 2
Ahmad 18

How is the easiest way to do this? Every month I retype all 2000 entries and there has to be an easier way.
Thanks in advance.
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
callmeshirley,


Sample raw data in worksheet Sheet1 before the macro:


Excel Workbook
ABCDE
1Billy101524
2Sally18106
3Ahman30218
4
Sheet1





After the macro in a new worksheet Results:


Excel Workbook
AB
1Billy10
2Billy15
3Billy24
4Sally18
5Sally10
6Sally6
7Ahman30
8Ahman2
9Ahman18
10
Results





Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).


1. Copy the below code, by highlighting the code and pressing the keys CTRL + C
2. Open your workbook
3. Press the keys ALT + F11 to open the Visual Basic Editor
4. Press the keys ALT + I to activate the Insert menu
5. Press M to insert a Standard Module
6. Where the cursor is flashing, paste the code by pressing the keys CTRL + V
7. Press the keys ALT + Q to exit the Editor, and return to Excel
8. To run the macro from Excel, open the workbook, and press ALT + F8 to display the Run Macro Dialog. Double Click the macro's name to Run it.


Code:
Option Explicit
Sub ReorgData()
' hiker95, 06/28/2011
' http://www.mrexcel.com/forum/showthread.php?t=560559
Dim w1 As Worksheet, wR As Worksheet
Dim LR As Long, a As Long, n As Long, LC As Long, NR As Long
Application.ScreenUpdating = False
Set w1 = Worksheets("Sheet1")
If Not Evaluate("ISREF(Results!A1)") Then Worksheets.Add(After:=w1).Name = "Results"
Set wR = Worksheets("Results")
wR.UsedRange.Clear
NR = 1
LR = w1.Cells(Rows.Count, 1).End(xlUp).Row
For a = 1 To LR Step 1
  LC = w1.Cells(a, Columns.Count).End(xlToLeft).Column
  n = LC - 1
  wR.Range("A" & NR).Resize(n).Value = w1.Cells(a, 1).Value
  wR.Range("B" & NR).Resize(n).Value = Application.Transpose(w1.Range(w1.Cells(a, 2), w1.Cells(a, LC)).Value)
  NR = wR.Range("A" & Rows.Count).End(xlUp).Offset(1).Row
Next a
wR.UsedRange.Columns.AutoFit
wR.Activate
Application.ScreenUpdating = True
End Sub


Then run the ReorgData macro.
 
Upvote 0

Forum statistics

Threads
1,224,618
Messages
6,179,917
Members
452,949
Latest member
beartooth91

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top