Unstack Multiple Columns of Data @Exceltrainingvideos
Unstack Multiple Columns of Data  @Exceltrainingvideos
Uploaded September 2020 | Updated September 2026, 2 weeks ago
How to unstack multiple columns of data using VBA.
Here's the complete VBA code:
Sub DataFormatting()

Dim lastrow As Long, i As Long, k As Long, ponum As Long, totvalue As Long

Dim MaterialCode As String
k = 6
totvalue = 0
Dim nextblankrow As Long
nextblankrow = Sheet1.Cells(Rows.Count, 6).End(xlUp).Offset(1, 0).Row
lastrow = Application.WorksheetFunction.CountA(Range("A:A"))


MaterialCode = InputBox("Enter Material code", "Material Code")
Range("F1") = "Material Code"
Range("G1") = "PO No"

For i = 2 To lastrow
If Cells(i, 1) = MaterialCode Then
Cells(nextblankrow, 6) = MaterialCode
Cells(nextblankrow, k + 1) = Cells(i, 2)
totvalue = totvalue + Cells(i, 3)
k = k + 1

End If
Next i
Cells(1, k + 1) = "Value"
Cells(nextblankrow, k + 1) = totvalue

End Sub
Unstack Multiple Columns of DataCreate Drop Down List to Display Shapes in ExcelLambda Functions in Microsoft ExcelConvert PDF to ExcelCopy Data Using Advanced Filter with VBAEfficiency of Arrays in CalculationsFilter Data for Current Month or YearCreate Multiple Copies of Master Sheet AutomaticallyA Super Simple Inventory Automation SystemAnalyze Data Using DGET FunctionPower BI Desktop Data Analysis VisualizationsHow to Open Most Recent File from Specific Folder
Dinesh Kumar Takyar |

Unstack Multiple Columns of Data

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER