Auto Calculation and Sort over Multiple Colums & Rows

Rusty Reeves

New Member
Joined
Apr 4, 2021
Messages
2
Office Version
  1. 2010
Platform
  1. Windows
Hi Team & Friends...

I need a VBA script that will automatically sort my data in my Top 20 Hits Spreadsheet in Excel which starts From Column A to Column H with Column H as the 1st Column to sort in Descending order. The rows is from Row 2 to Row 23... (Row 1 Headers) The rows must move up or down depending on the figure in Column H which must be automatically sorted according to the total in Column H.

Stereo1 Top 20 Gospel Hits Vote Sheet 2021_1_BB.xlsx
ABCDEFGH
1Top 20 Results 27 January 2021eMailW/AppSMSF/BookVotes% Votes
23C4141108.40
34D512197.56
42B311165.04
55E113165.04
61A215197.56
76F111211512.61
87G111143.36
98H111143.36
109I111143.36
1110J111143.36
1211K111143.36
1312L111143.36
1413M111143.36
1514N111143.36
1615O111143.36
1716P111143.36
1817Q111143.36
1918R111143.36
2019S111143.36
2120T111143.36
2221U111143.36
2322V111143.36
2411932323322119100.00
25Votes CountedTotal VotesTotal %
Sheet1
Cell Formulas
RangeFormula
G2:G23G2=SUM(C2:F2)
H2:H23H2=G2/I2*100
B24B24=G24
C24:H24C24=SUM(C2:C23)
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Hi Rusty Reeves... Welcome to the MrExcel Forum!

Have you tried using the Macro Recorder...
 
Upvote 0
I have my VBA as follows for description above...
Private Sub Worksheet_Change(ByValueTarget As Excel.Range)
If Target.Column = 8 Then
DimlastRow = "A23"

LastRow = Cells(Rows.Count, 8).End(xlUp).Row
Range("A2:H" & LastRow).Sort Key1:=Range("H2:H" & LastRow), order1:=xlDescending, Header:=xlNo

End If

End Sub

But is wont calculate and move cell in row up to higher or lower position according to data in Column H
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,874
Members
452,363
Latest member
merico17

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