Hello Sarah,
Welcome to the Forum!
This macro will reformat the data as you described.
Sub ReFormatData()
Dim Data As Variant
Dim I As Long
Dim N As Long
Dim RngEnd As Range
Dim SrcRng As Range
Dim SrcWks As Worksheet
Set SrcWks = Worksheets("Sheet1")
Set SrcRng = SrcWks.Range("A1:C1")
Set RngEnd = SrcWks.Cells(Rows.Count, SrcRng.Column).End(xlUp)
If RngEnd.Row > SrcRng.Row Then
Set SrcRng = SrcWks.Range(SrcRng, RngEnd)
End If
Data = SrcRng.Value
SrcRng.ClearContents
For I = 1 To (SrcRng.Rows.Count * 2) - 1 Step 2
N = N + 1
SrcRng.Cells(1, I).Value = Data(N, 1)
SrcRng.Cells(2, I).Value = Data(N, 2)
SrcRng.Cells(2, I + 1).Value = Data(N, 3)
Next I
End Sub
Adding the Macro- Copy the macro above pressing the keys CTRL+C
- Open your workbook
- Press the keys ALT+F11 to open the Visual Basic Editor
- Press the keys ALT+I to activate the Insert menu
- Press M to insert a Standard Module
- Paste the code by pressing the keys CTRL+V
- Make any custom changes to the macro if needed at this time.
- Save the Macro by pressing the keys CTRL+S
- Press the keys ALT+Q to exit the Editor, and return to Excel.
To Run the Macro...
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.
Bookmarks