I have this macro-----It will run when i click a button on sheet2
Sub btn_Consolidate_Click()
Static wsData As Worksheet: Set wsData = Sheets("Sheet1")
Static wsDest As Worksheet: Set wsDest = ActiveSheet
wsDest.UsedRange.Offset(1).ClearContents
Intersect(wsData.UsedRange, wsData.Columns("A")).AdvancedFilter xlFilterCopy, , wsDest.Range("A1"), True
With Range(wsDest.Range("B2"), wsDest.Cells(Rows.Count, "A").End(xlUp).Offset(0, 1))
.Formula = "=SumIf('" & wsData.Name & "'!A:A,A2,'" & wsData.Name & "'!B:B)"
.Value = .Value
End With
End Sub
It consolidates data from sheet 1 column A (which is ID numbers) and sums the corresponding data from column b and with a click of a button places it on sheet two.
Two questions....how do I change this macro so that it will sort the results on sheet two by descending in column b?
Also I want to fill in the same type of data on Column C and D of sheet one and have a command button on sheet two that will do the same thing but on column C and D and then continue on with E and F. Then G and H, I and J, K and L........I need a hundred macro buttons on sheet 2.
Attached is what I have so far....Thanks
Bookmarks