I have a "filtered databse" where I want to sum the data in the first few "visible" rows (assume 10 rows). I know the "=subtotal(9,range)" formula, but it doesn't work effectively, as each time I change the filter, the range changes in the formula. Is there a way around this to always select the first 10 visible rows without row numbers being specified?
Below is a macro that I recorded that works porly, because the row information for each selection would always have to be the same. This is a problem since the data will change weekly and thus the row numbers will be different effectively nullifying the usefulness of a macro.
Selection.AutoFilter
Selection.AutoFilter Field:=15, Criteria1:="2003"
Selection.AutoFilter Field:=14, Criteria1:="WEEK 1"
Selection.AutoFilter Field:=13, Criteria1:="MEN'S"
Sheets("Test").Select
Range("D11").Select
Sheets("MARS Data TY").Select
Selection.AutoFilter Field:=13, Criteria1:="WOMENS"
Sheets("Test").Select
ActiveCell.FormulaR1C1 = "=SUBTOTAL(9,'MARS Data TY'!R[4]C:R[45]C[3])"
Range("D12").Select
Sheets("MARS Data TY").Select
Selection.AutoFilter Field:=13, Criteria1:="ACCESS"
Sheets("Test").Select
ActiveCell.FormulaR1C1 = "=SUBTOTAL(9,'MARS Data TY'!R[4]C:R[822]C[3])"
Range("D13").Select
Sheets("MARS Data TY").Select
Selection.AutoFilter Field:=13, Criteria1:="BOYS"
Sheets("Test").Select
ActiveCell.FormulaR1C1 = "=SUBTOTAL(9,'MARS Data TY'!R[4]C:R[291]C[3])"
Range("D14").Select
Also, Are there any great books out there on Excel and/or VBA (I have "Mastering Excel 2000 Premium Edition by Sybex" & "Microsoft Excel 2000 Power Programming with VBA by John Walkenbach"). Both these books are good for initially understanding some beg and intermediate things, but after this they don't help with complex items.
Thanks in advance for any help you provide.
Rick
Below is a macro that I recorded that works porly, because the row information for each selection would always have to be the same. This is a problem since the data will change weekly and thus the row numbers will be different effectively nullifying the usefulness of a macro.
Selection.AutoFilter
Selection.AutoFilter Field:=15, Criteria1:="2003"
Selection.AutoFilter Field:=14, Criteria1:="WEEK 1"
Selection.AutoFilter Field:=13, Criteria1:="MEN'S"
Sheets("Test").Select
Range("D11").Select
Sheets("MARS Data TY").Select
Selection.AutoFilter Field:=13, Criteria1:="WOMENS"
Sheets("Test").Select
ActiveCell.FormulaR1C1 = "=SUBTOTAL(9,'MARS Data TY'!R[4]C:R[45]C[3])"
Range("D12").Select
Sheets("MARS Data TY").Select
Selection.AutoFilter Field:=13, Criteria1:="ACCESS"
Sheets("Test").Select
ActiveCell.FormulaR1C1 = "=SUBTOTAL(9,'MARS Data TY'!R[4]C:R[822]C[3])"
Range("D13").Select
Sheets("MARS Data TY").Select
Selection.AutoFilter Field:=13, Criteria1:="BOYS"
Sheets("Test").Select
ActiveCell.FormulaR1C1 = "=SUBTOTAL(9,'MARS Data TY'!R[4]C:R[291]C[3])"
Range("D14").Select
Also, Are there any great books out there on Excel and/or VBA (I have "Mastering Excel 2000 Premium Edition by Sybex" & "Microsoft Excel 2000 Power Programming with VBA by John Walkenbach"). Both these books are good for initially understanding some beg and intermediate things, but after this they don't help with complex items.
Thanks in advance for any help you provide.
Rick