Macro not showing Text Total

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,561
Office Version
  1. 2021
Platform
  1. Windows
I have a macro below to show text "Total" in Column A and the total value in Column B in row 30

The data is filtered, so a subtotal needs to compute the value of the values displayed

Code:
 Sub Totals_Extract()
Dim Finalrow As Long
With Application
    .ScreenUpdating = False
    .CutCopyMode = False
    .Calculation = xlCalculationManual
End With
         
   
        With Sheets("Extract")
            Finalrow = .Range("A65536").End(xlUp).Row
            .Range("A" & Finalrow + 3).Value = "Total"
            .Range("B" & Finalrow + 3).FormulaR1C1 = "=SUBTOTAL(9,R[-25]C:R[-1]C)"
            End With
        
              
With Application
    .ScreenUpdating = True
    .CutCopyMode = False
    .Calculation = xlCalculationAutomatic
 End With
End Sub


It would be appreciated if someone could amend my code
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Try this version:
VBA Code:
Sub Totals_Extract()
Dim Finalrow As Long
'
With Sheets("Foglio1")
    Finalrow = .Cells(Rows.Count, "A").End(xlUp).Row
    .Range("A" & Finalrow + 3).Value = "Total"
    .Range("B" & Finalrow + 3).Formula = "=SUBTOTAL(9,B2:B" & Finalrow & ")"
End With
End Sub
 
Upvote 0
Solution
Many thanks Anthony47. Your code works perfectly
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,695
Members
448,979
Latest member
DET4492

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