MrSourApple
New Member
- Joined
- Oct 23, 2015
- Messages
- 17
I am trying to have vba enter a sumif formula into cell E8 on the sheet named "EOC"
Based on the sumif formula (below) here is the information I have:
=sumif(range, criteria, sum range)
Range:
The range for the sumif formula is column AF of a particular sheet. The sheet however will change based on the value of the cell E19 on the sheet "Admin".
(i.e. If Admin!E19 is equal to "Passback" it will look at the worksheet "Passback", and if it is Official it will look at the worksheet "Official" --- there are many other options these are just examples)
Criteria:
The criteria for the sumif formula is if it equals cell D8 of the sheet EOC
Sum range:
The sum range is column AM of the same sheet mentioned above (based on cell E19 of the "Admin" tab).
Here is the code I have but I can't seem to get it to work:
Any ideas on how to get this to work? The formula is actually a lot longer and will be dragged down a number of cells but if I can get this part to work I will be able to get the rest as well.
Based on the sumif formula (below) here is the information I have:
=sumif(range, criteria, sum range)
Range:
The range for the sumif formula is column AF of a particular sheet. The sheet however will change based on the value of the cell E19 on the sheet "Admin".
(i.e. If Admin!E19 is equal to "Passback" it will look at the worksheet "Passback", and if it is Official it will look at the worksheet "Official" --- there are many other options these are just examples)
Criteria:
The criteria for the sumif formula is if it equals cell D8 of the sheet EOC
Sum range:
The sum range is column AM of the same sheet mentioned above (based on cell E19 of the "Admin" tab).
Here is the code I have but I can't seem to get it to work:
Code:
Sheets("EOC").Range("H8").Formula = _
"=Sumif(Sheets(Sheets("Admin").Range("E19").Value).Range("AF:AF"),Sheets("EOC").Range("D8"),Sheets(Sheets("Admin").Range("E19").Value).Range("AM:AM"))"
Any ideas on how to get this to work? The formula is actually a lot longer and will be dragged down a number of cells but if I can get this part to work I will be able to get the rest as well.