Excel VBA-summing 3 columns by codes


Posted by Michelle on July 15, 2001 10:52 AM

Hello:

I am currently working on a project that requires me to program Excel to a sort a column, say column "J" (which contains "Y" and "N"). For each "Y" and "N" sum the corresponding columns (A, B and C). My question is, how do u sum all three columns?

Posted by Malc on July 15, 2001 6:11 PM

Try using subtotals in the Data menu or try a pivot table



Posted by Malc on July 16, 2001 1:48 AM

Should have said record a macro doing the sort and inserting subtotals see how it works and modify it to do want you want. Also record pressing the end then the down arrow in one of the columns with the data you are sorting. It will give you the code to get the address of the last row in the list.(there are heaps of other ways as well) You could do something like RowNum = Activecell.row to get the range you are sorting
Hope that helps