Avatar of Andreas Hermle
Andreas Hermle
Flag for Germany

asked on 

Enter Formula into cell below filtered list using VBA

Dear Experts:

I would like to enter the formula in line 7 in another way, i.e. no hardcoding of the range.

The Formula is to be entered into Column A, two cells below the last filled cell of the filtered list no matter how many rows there are.

Help is much appreciated. Thank you very much in advance.

Regards, Andreas


Sub Enter_SubTotal_End_of_Filtered_List()


    ThisWorkbook.Worksheets("3_Gesamtliste").Range("A1:M" & Range("A" & Rows.Count).End(xlUp).Row).AutoFilter Field:=4, Criteria1:="="
    
    
        Range("A13980").Formula = Application.WorksheetFunction.Subtotal(9, Range("A1:A" & Range("B" & Rows.Count).End(xlUp).Row))
      
  
End Sub

Open in new window

VBAMicrosoft ExcelMicrosoft Office

Avatar of undefined
Last Comment
Andreas Hermle

8/22/2022 - Mon