Damon Ostrander


Posted by Craig on July 06, 2001 10:41 AM

I tried your VB code to sum cells that were highlighted in a certain color, the original post was 7/3 @ 12:17:14 if you want to take a look...

I went to VB editor and opened up the editor for Sheet 3 and typed in the 8 line code verbatim, then typed in some random numbers and highlighted two of them then typed in the Sumifcolor function for the series of numbers with only 2 highlited in yellow. The cell value = #NAME? - What did I do wrong????

Posted by Damon Ostrander on July 06, 2001 1:01 PM

Hi Craig,

The only mistake was in where you put the code. When you said you opened up the editor for sheet 3, that means that you put the code in the worksheet's event code area. This is where code goes that uses worksheet events, for example the Worksheet_Change event. Excel will not be able to "see" custom macros and functions inserted here. When you want a function or macro to be available to all areas of a workbook globally, you must place it in a macro module. This also happens to be the place that macros go when you record them. If your workbook does not already have a Module, create one using the VB Editor's Insert -> Module menu. Then simply paste the code into the code pane that opens. Since modules can have any number of routines in them, you can also paste this code into an existing module if you have one.



Posted by Craig on July 06, 2001 2:49 PM

Damon,

Yes it worked!! Thank You Very Much!!

CRaig