Hello,
I have an Excel spreadsheet that keeps track of the monthly donations (several times a month) of about 200 different companies.
My job is to have a monthly report that provides the total amount of donations made by each company.
I am not an Excel spreadsheet expert and I don't know anything about Pivot Tables. But, I came up with the macro indicated below that does the job.
Sheets("Database").Select
Range("A1").Select
'*** QUERY FOR A.C. Campbale ***
Range("database_cell_criteria_area_company").Select
ActiveCell.FormulaR1C1 = "A.C. Compbale"
Range("database_cell_criteria_area_month").Select
ActiveCell.FormulaR1C1 = "Jan"
Range("database_query_range_database").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range( _
"database_query_range_criteria"), CopyToRange:=Range("database_query_output_range_001"), Unique:=False
'*** QUERY FOR Acosta Farms ***
Range("database_cell_criteria_area_company").Select
ActiveCell.FormulaR1C1 = "Acosta Farms"
Range("database_cell_criteria_area_month").Select
ActiveCell.FormulaR1C1 = "Jan"
Range("database_query_range_database").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range( _
"database_query_range_criteria"), CopyToRange:=Range("database_query_output_range_002"), Unique:=False
As you can see, I had to write the macro repeatedly, actually, about 200 times to accomodate my list.
I was just wondering if the macro can be shortened by FOR NEXT LOOP and if if will, I don't know how to write the syntax.
Please help.
Thanks,
Dante Banez
I have an Excel spreadsheet that keeps track of the monthly donations (several times a month) of about 200 different companies.
My job is to have a monthly report that provides the total amount of donations made by each company.
I am not an Excel spreadsheet expert and I don't know anything about Pivot Tables. But, I came up with the macro indicated below that does the job.
Sheets("Database").Select
Range("A1").Select
'*** QUERY FOR A.C. Campbale ***
Range("database_cell_criteria_area_company").Select
ActiveCell.FormulaR1C1 = "A.C. Compbale"
Range("database_cell_criteria_area_month").Select
ActiveCell.FormulaR1C1 = "Jan"
Range("database_query_range_database").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range( _
"database_query_range_criteria"), CopyToRange:=Range("database_query_output_range_001"), Unique:=False
'*** QUERY FOR Acosta Farms ***
Range("database_cell_criteria_area_company").Select
ActiveCell.FormulaR1C1 = "Acosta Farms"
Range("database_cell_criteria_area_month").Select
ActiveCell.FormulaR1C1 = "Jan"
Range("database_query_range_database").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range( _
"database_query_range_criteria"), CopyToRange:=Range("database_query_output_range_002"), Unique:=False
As you can see, I had to write the macro repeatedly, actually, about 200 times to accomodate my list.
I was just wondering if the macro can be shortened by FOR NEXT LOOP and if if will, I don't know how to write the syntax.
Please help.
Thanks,
Dante Banez