is there a way i can create a macro to Autosum a column by searching through row 1 for the word total or grand total in first cell of the column?
is there a way i can create a macro to Autosum a column by searching through row 1 for the word total or grand total in first cell of the column?
Last edited by daillest319; 02-21-2012 at 03:17 PM.
Hi daillest319
The SumIf function may well work...what's your data look like?
Last edited by jaslake; 02-21-2012 at 01:37 PM. Reason: meant to say SumIf
John
If you have issues with Code I've provided, I appreciate your feedback.
In the event Code provided resolves your issue, please mark your Thread as SOLVED.
If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.
The first row are the column names but total can be in column G one day and H another etc. So i want it to just sum the total of whatever column the word total is in row 1. so basiclly look for the word in row 1 and total the column from the last cell to cell 2 because cell one is always the column name.
test.xls
Last edited by daillest319; 02-21-2012 at 02:05 PM.
Hi daillest319
Try this codePlease Login or Register to view this content.
this would work but the only problem the amount of rows in the workbook always changes and right now this is only giving me a total from three cells up. sometime it 50 rows something its 100 so the if it can go from the last cell up to the cell 2 it would be perfect.
Hi daillest319
Sorry about that...didn't adjust the formulaPlease Login or Register to view this content.
thank you so much for your help. I have one more question is it possible to make this for any worksheet instead of using With Sheets("test")? so i dont have to rename the worksheet test everytime. Thanks again.
If it's ALWAYS the Active SheetPlease Login or Register to view this content.
Thank you so much it works perfect. i also wanted to use counta() on the coulmn where city is. can i just replace total with city and and =sum( with =counta(?
Please Login or Register to view this content.
there actually another problem it grabbbing cell one instead just stopping at cell 2
for example it doing this =SUM(U1:U183) instead of =SUM(U2:U183)
Hi daillest319
SUMIF works as previously written but COUNTA won't. This code should work for bothPlease Login or Register to view this content.
Thank you!!!! Works perfect
Hi daillest319
You're welcome...glad I could help.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks