excel count cell with color conditional formatting

Can i count number (sum) of cells in a column colored with conditional 
formatting ?

thx

the formula is =ISNUMBER(MATCH(D3;$AL3:$AR3;0))
column D3:D400
color red 


0
11/18/2005 6:19:31 PM
excel 39879 articles. 2 followers. Follow

6 Replies
858 Views

Similar Articles

[PageSpeed] 22

It' difficult.

See http://www.xldynamic.com/source/xld.CFConditions.html

-- 

HTH

RP
(remove nothere from the email address if mailing direct)


"Marco" <marco.w-no-spam-please@email.it> wrote in message
news:OL%23BeyG7FHA.2384@TK2MSFTNGP12.phx.gbl...
> Can i count number (sum) of cells in a column colored with conditional
> formatting ?
>
> thx
>
> the formula is =ISNUMBER(MATCH(D3;$AL3:$AR3;0))
> column D3:D400
> color red
>
>


0
bob.phillips1 (6510)
11/18/2005 6:25:58 PM
Can you not just use the same logic that colours it within a formula?

=SUMPRODUCT(--ISNUMBER(MATCH(D3:D400;$AL$3:$AR$3;0)))

-- 
Regards
           Ken.......................    Microsoft MVP - Excel
              Sys Spec - Win XP Pro /  XL 97/00/02/03

------------------------------�------------------------------�----------------
It's easier to beg forgiveness than ask permission :-)
------------------------------�------------------------------�----------------


"Marco" <marco.w-no-spam-please@email.it> wrote in message 
news:OL%23BeyG7FHA.2384@TK2MSFTNGP12.phx.gbl...
> Can i count number (sum) of cells in a column colored with conditional 
> formatting ?
>
> thx
>
> the formula is =ISNUMBER(MATCH(D3;$AL3:$AR3;0))
> column D3:D400
> color red
> 


0
ken.wright (2489)
11/20/2005 9:26:52 AM
Ken Wright  wrote:
> Can you not just use the same logic that colours it within a formula?
>
> =SUMPRODUCT(--ISNUMBER(MATCH(D3:D400;$AL$3:$AR$3;0)))

Thanks for the answer, I try to explain in English.
 Nobody of the suggested methods seems to work in my case, if I have 
understood.
 The method of Bob Phillips why i use the  list separator semicolon (;)  in 
the formulas, instead of comma (,) , therefore it gives back  # value!  in 
result cell.
Your formula why my comparison is made only for row, and  i comparison every 
single cell with a range (AL:AR) of the same fixed row .
=ISNUMBER(MATCH(D2;$AL2:$AR2;0)) =ISNUMBER(MATCH(E2;$AL2:$AR2;0)) 
=ISNUMBER(MATCH(F2;$AL2:$AR2;0))
=ISNUMBER(MATCH(D3;$AL3:$AR3;0)) 
=ISNUMBER(MATCH(E3;$AL3:$AR3;0))=ISNUMBER(MATCH(F3;$AL3:$AR3;0))
.....

 I don't know if exist an other solution without conditional formatting for 
this problem: knowing the number of cells in a column, that cell is equal to 
range in the row.
 The my real rows are thousand approximately every 2-4 months.
 For now i have characterized 3 solutions:
1) to count them  by hand .
2) change the settings of the computer and try to use Bob Phillips formulas.
3) to wait for until 2006 office 12 , sort and filter by color ( count color 
will be better), fantastic for a profane  like me.

>
> -- 
> Regards
>           Ken.......................    Microsoft MVP - Excel
>              Sys Spec - Win XP Pro /  XL 97/00/02/03
>
> ------------------------------�------------------------------�----------------
> It's easier to beg forgiveness than ask permission :-)
> ------------------------------�------------------------------�----------------

Best regards 


0
11/20/2005 2:16:54 PM
> For now i have characterized 3 solutions:

> 1) to count them  by hand .

Would never consider that an option.  Lots of ways to do what you want with 
helper columns etc. Nice and neat to do it with a single formula if possible 
though.

> 2) change the settings of the computer and try to use Bob Phillips 
> formulas.

You could try this and then just change the settings back, and I think it 
would all adjust accordingly - not sure though.

> 3) to wait for until 2006 office 12 , sort and filter by color ( count 
> color will be better), fantastic for a profane  like me.

No guarantees that it will do this until it is actually released, and even 
if it lets you count colours, that doesn't mean you can count conditionally 
formatted colours.


I'm sure there must be a way to condense this, but my brain's pretty fried 
at the moment, so try this:-

=SUMPRODUCT((($D$3:$D$400)=($AL$3:$AR$400))+(($E$3:$E$400)=($AL$3:$AR$400))+(($F$3:$F$400)=($AL$3:$AR$400)))

This should count any cell in cells Dx Ex Fx that have values that appear in 
the corresponding rows ALx:ARx

Regards
              Ken.................


"Marco" <marco.w-no-spam-please@email.it> wrote in message 
news:edDNR0d7FHA.3752@tk2msftngp13.phx.gbl...
>
> Ken Wright  wrote:
>> Can you not just use the same logic that colours it within a formula?
>>
>> =SUMPRODUCT(--ISNUMBER(MATCH(D3:D400;$AL$3:$AR$3;0)))
>
> Thanks for the answer, I try to explain in English.
> Nobody of the suggested methods seems to work in my case, if I have 
> understood.
> The method of Bob Phillips why i use the  list separator semicolon (;)  in 
> the formulas, instead of comma (,) , therefore it gives back  # value!  in 
> result cell.
> Your formula why my comparison is made only for row, and  i comparison 
> every single cell with a range (AL:AR) of the same fixed row .
> =ISNUMBER(MATCH(D2;$AL2:$AR2;0)) =ISNUMBER(MATCH(E2;$AL2:$AR2;0)) 
> =ISNUMBER(MATCH(F2;$AL2:$AR2;0))
> =ISNUMBER(MATCH(D3;$AL3:$AR3;0)) 
> =ISNUMBER(MATCH(E3;$AL3:$AR3;0))=ISNUMBER(MATCH(F3;$AL3:$AR3;0))
> ....
>
> I don't know if exist an other solution without conditional formatting for 
> this problem: knowing the number of cells in a column, that cell is equal 
> to range in the row.
> The my real rows are thousand approximately every 2-4 months.
> For now i have characterized 3 solutions:
> 1) to count them  by hand .
> 2) change the settings of the computer and try to use Bob Phillips 
> formulas.
> 3) to wait for until 2006 office 12 , sort and filter by color ( count 
> color will be better), fantastic for a profane  like me.
>
>>
>> -- 
>> Regards
>>           Ken.......................    Microsoft MVP - Excel
>>              Sys Spec - Win XP Pro /  XL 97/00/02/03
>>
>> ------------------------------�------------------------------�----------------
>> It's easier to beg forgiveness than ask permission :-)
>> ------------------------------�------------------------------�----------------
>
> Best regards
> 


0
ken.wright (2489)
11/20/2005 4:00:54 PM
Ken Wright wrote:
> I'm sure there must be a way to condense this, but my brain's pretty fried 
> at the moment, so try this:-
>
> =SUMPRODUCT((($D$3:$D$400)=($AL$3:$AR$400))+(($E$3:$E$400)=($AL$3:$AR$400))+(($F$3:$F$400)=($AL$3:$AR$400)))

That formula does not give back the attended result.
 It would be simpler to explain if i could attaching file.
>
> This should count any cell in cells Dx Ex Fx that have values that appear 
> in the corresponding rows ALx:ARx
>
> Regards
>              Ken.................
>
>
Regards


> "Marco" <marco.w-no-spam-please@email.it> wrote in message 
> news:edDNR0d7FHA.3752@tk2msftngp13.phx.gbl...
>>
>> Ken Wright  wrote:
>>> Can you not just use the same logic that colours it within a formula?
>>>
>>> =SUMPRODUCT(--ISNUMBER(MATCH(D3:D400;$AL$3:$AR$3;0)))
>>
>> Thanks for the answer, I try to explain in English.
>> Nobody of the suggested methods seems to work in my case, if I have 
>> understood.
>> The method of Bob Phillips why i use the  list separator semicolon (;) 
>> in the formulas, instead of comma (,) , therefore it gives back  # value! 
>> in result cell.
>> Your formula why my comparison is made only for row, and  i comparison 
>> every single cell with a range (AL:AR) of the same fixed row .
>> =ISNUMBER(MATCH(D2;$AL2:$AR2;0)) =ISNUMBER(MATCH(E2;$AL2:$AR2;0)) 
>> =ISNUMBER(MATCH(F2;$AL2:$AR2;0))
>> =ISNUMBER(MATCH(D3;$AL3:$AR3;0)) 
>> =ISNUMBER(MATCH(E3;$AL3:$AR3;0))=ISNUMBER(MATCH(F3;$AL3:$AR3;0))
>> ....
>>
>> I don't know if exist an other solution without conditional formatting 
>> for this problem: knowing the number of cells in a column, that cell is 
>> equal to range in the row.
>> The my real rows are thousand approximately every 2-4 months.
>> For now i have characterized 3 solutions:
>> 1) to count them  by hand .
>> 2) change the settings of the computer and try to use Bob Phillips 
>> formulas.
>> 3) to wait for until 2006 office 12 , sort and filter by color ( count 
>> color will be better), fantastic for a profane  like me.
>>
>>>
>>> -- 
>>> Regards
>>>           Ken.......................    Microsoft MVP - Excel
>>>              Sys Spec - Win XP Pro /  XL 97/00/02/03
>>>
>>> ------------------------------�------------------------------�----------------
>>> It's easier to beg forgiveness than ask permission :-)
>>> ------------------------------�------------------------------�----------------
>>
>> Best regards
>>
>
> 


0
11/20/2005 4:43:41 PM
By all means mail it to me at ken dot wright at ntlworld dot com

Regards
              Ken....................

> That formula does not give back the attended result.
> It would be simpler to explain if i could attaching file.


"Marco" <marco.w-no-spam-please@email.it> wrote in message 
news:%23TvmSGf7FHA.3984@TK2MSFTNGP11.phx.gbl...
>
> Ken Wright wrote:
>> I'm sure there must be a way to condense this, but my brain's pretty 
>> fried at the moment, so try this:-
>>
>> =SUMPRODUCT((($D$3:$D$400)=($AL$3:$AR$400))+(($E$3:$E$400)=($AL$3:$AR$400))+(($F$3:$F$400)=($AL$3:$AR$400)))
>
>>
>> This should count any cell in cells Dx Ex Fx that have values that appear 
>> in the corresponding rows ALx:ARx
>>
>> Regards
>>              Ken.................
>>
>>
> Regards
>
>
>> "Marco" <marco.w-no-spam-please@email.it> wrote in message 
>> news:edDNR0d7FHA.3752@tk2msftngp13.phx.gbl...
>>>
>>> Ken Wright  wrote:
>>>> Can you not just use the same logic that colours it within a formula?
>>>>
>>>> =SUMPRODUCT(--ISNUMBER(MATCH(D3:D400;$AL$3:$AR$3;0)))
>>>
>>> Thanks for the answer, I try to explain in English.
>>> Nobody of the suggested methods seems to work in my case, if I have 
>>> understood.
>>> The method of Bob Phillips why i use the  list separator semicolon (;) 
>>> in the formulas, instead of comma (,) , therefore it gives back  # 
>>> value! in result cell.
>>> Your formula why my comparison is made only for row, and  i comparison 
>>> every single cell with a range (AL:AR) of the same fixed row .
>>> =ISNUMBER(MATCH(D2;$AL2:$AR2;0)) =ISNUMBER(MATCH(E2;$AL2:$AR2;0)) 
>>> =ISNUMBER(MATCH(F2;$AL2:$AR2;0))
>>> =ISNUMBER(MATCH(D3;$AL3:$AR3;0)) 
>>> =ISNUMBER(MATCH(E3;$AL3:$AR3;0))=ISNUMBER(MATCH(F3;$AL3:$AR3;0))
>>> ....
>>>
>>> I don't know if exist an other solution without conditional formatting 
>>> for this problem: knowing the number of cells in a column, that cell is 
>>> equal to range in the row.
>>> The my real rows are thousand approximately every 2-4 months.
>>> For now i have characterized 3 solutions:
>>> 1) to count them  by hand .
>>> 2) change the settings of the computer and try to use Bob Phillips 
>>> formulas.
>>> 3) to wait for until 2006 office 12 , sort and filter by color ( count 
>>> color will be better), fantastic for a profane  like me.
>>>
>>>>
>>>> -- 
>>>> Regards
>>>>           Ken.......................    Microsoft MVP - Excel
>>>>              Sys Spec - Win XP Pro /  XL 97/00/02/03
>>>>
>>>> ------------------------------�------------------------------�----------------
>>>> It's easier to beg forgiveness than ask permission :-)
>>>> ------------------------------�------------------------------�----------------
>>>
>>> Best regards
>>>
>>
>>
>
> 


0
ken.wright (2489)
11/20/2005 4:56:30 PM
Reply:

Similar Artilces:

Colored Scroll bars
Hi, We would like to change background color of all scroll bar components in our ..Net application, but change should apply to all controls in our application. I mean not only ScrollBar controls explicitly used, but scroll bars in tree, listview, combo and third-party controls etc. We even have MFC control used through managed c++ wrapper with its own scroll bars. Is there some way to do it (subclassing windows, application-wide hook, etc) ? We can code it Win32 pure if it helps. Alexander Arlievsky. Scroll bars in list controls, tree controls, etc. are not "real" scroll bars, bu...

Changing Cells and entering data in them
Thanks for the help again. Big thanks to Steve you've got me this far. I went out and bought a book, but it's like reading a foreign language. I was informed today that I can't have message boxes come up. I need to have the code point at the cells and if they are blank turn which ever one is blank red or if both are then both turn red then pause for each cell to be filled in. Cell F14 "Last Name" then automatically go to Cell F16 "First Name" on tab or enter. Basically if Cell F22 or F23 has an X in it, Cells F14 an F16 turn red and cell F14 has the focus...

Excel button problem
Hi All I have a macro that copies a worksheet in the active workbook and puts it into a new workbook - then formats it and deletes any buttons on the worksheet. On the first click on the button the macro works ok. On the second click, it fails because the all assigned macros on all buttons in the active workbook changed from "mba" to "book1!mba". Book 1 doesn't exists (wasn't opened, wasn't saved, doesn't have the macros). I've never experienced this problem before?? Can anyone help to solve this problem? FYI The macro to do this is c...

Excel 97 #9
Please can anyone help??? I have two columns in Excel 97. The first contains a list of statu values eg. pending, or granted or withdrawn. The second contains date eg.01/12/1997, 05/06/2003. I woudl like to know how to get all th granted apps before 31/12/2003. Can anyone help please -- Message posted from http://www.ExcelForum.com theres many ways, but an easiest way would be to do a sort. Highlight the 2 columns, click on data, then sort, then sort by status, then by date. this should group them all together. hope this helps...toe >-----Original Message----- >Please can anyo...

conditional formatting sort
Is there a way to sort after conditional formatting. So, if I've set up a conditional format to color my text red if the number is between 0 and 95, then I want to sort so all red numbers are at the top of the spreadsheet? Any ideas? Thanks for your time and assistance. Roberta On Thu, 25 Oct 2007 05:08:00 -0700, rrupp <rrupp@discussions.microsoft.com> wrote: You can't sort by color, but you can add a column to your query like this: SortColumn: Iif(SomeValue >= 0 and SomeValue <= 95, 1, 2) Then sort by this column. -Tom. >Is there a way to sort after condition...

Count If Formula #4
I need a formula that will figure the following: If column C = 3, count all times < 00:45 If column C = 4, count all times < 00:45 If column C = 3, count all times > 00:46 Thanks. Your description is a bit confused.You have different actions for the same value (C=3). And where are the times, in a different column than C? So, making many assumptions, perhaps =SUMPRODUCT(--(ISNUMBER(MATCH(C1:C200,{3,4},0))),--(D1:D200<TIME(0,45,0)))+S UMPRODUCT(--(C1:C200=5),--(D1:D200<TIME(0,46,0))) -- HTH RP (remove nothere from the email address if mailing direct) "Denise"...

Looking for Excel Help
I'm a very novice Excel user and am looking for a little help with creating a formula for a spreadsheet I'm creating for my personal use. I would appreciate some assistance if possible. Thanks in advance. Dan --- Message posted from http://www.ExcelForum.com/ Hi Dan! Post a sample of what you want to do. Your question is just a tad open ended <g> -- Regards Norman Harker MVP (Excel) Sydney, Australia njharker@optusnet.com.au Excel and Word Function Lists (Classifications, Syntax and Arguments) available free to good homes. "DanB4105" <DanB4105.ywtpa@excelfor...

New to excel
Hi All, I'm new to Excel ( and to this forum :) ) and so I hope somebody may b able to help me. I've got 2 questions.... QUESTION 1 I've got a spreadsheet which takes data from one worksheet and uses i to calculate data in a second worksheet using the following code formula: =IF('4th November 2005'!B19="","nothing here dude",IF(B19<'4th Novembe 2005'!B19,"UP",IF(B19='4th November 2005'!B19,"Same",IF(B19>'4t November 2005'!B19,"DOWN")))) The problem is, when I create a new worksheet I have...

Excel corrupts when asking to update vlookups
We are experiencing weird behavior with some Office 2K3 Excel spreadsheets that contain lots of calculations, but no macros. On some pc’s Excel acts normally, on others you get the error. I have a couple of screen shots available. Any help is appreciated. If desired, send your file to my address below. I will only look if: 1. You send a copy of this message on an inserted sheet 2. You give me the newsgroup and the subject line 3. You send a clear explanation of what you want 4. You send before/after examples and expected results. -- Don Gu...

Uninstall of mappoint has caused errors with excel
Hi, I am running Office 2003 on the terminal server (windows 2003) and had a copy of mappoint as well. This is a mapping program. We ininstalled mappoint which has caused an error message with Excel and other office products. The error says "Cd:\documents and settings\administrator.ocrdc1\application data\microsoft\addins c:\Program files\common files\microsoft shared\geography\mpoai9.dll is not a valid add-in." I then click OK and excel opens up and everything is fine. The problem is that we are using other programs as well such as Quickbooks that export to excel and t...

Show date, time & day of week in one cell
Can I show the date, time and day of week in one cell. I have: 09/03/07 8:30 AM in one cell using the format (Format/Cells/Custom): [$-409]mm/dd/yy h:mm AM/PM;@ Excel refuses to accept ddd for Mon or dddd Monday at the end of the format I want it to read: 09/03/07 8:30 AM Monday in 1 cell. I have Excel 2003. One way: mm/dd/yy h:mm AM/PM dddd;@ In article <Xns99B8A3CAF9130pencilunlistedcom@208.49.82.220>, Burp <burp@beep.comINVALID> wrote: > Can I show the date, time and day of week in one cell. > > I have: > 09/03/07 8:30 AM > in one cell using the for...

How do I Remove a Split from my Comments in Excel 2003? #2
I have set my current workbook to split/freeze the first column and first 2 rows. Now, when I add a comment to the second row (in any column) my comments are cut off if I should scroll down. I don't ever remember the behavior before. And I don't know what I've done to enable it but it's really annoying. How do turn this off ? ...

default values in a cell
Hello, can you help me please Cell B1 contains a complex mathematical formula which requires (in several places) a number from cell A1. Cell A1 can contain any integer number, but it is usually the same (30). I would like to be able to leave cell A1 empty, and only enter a number when it is not 30 , ie the default value of A1 is 30, unless specified. How do I go about this ? Should I look at conditional formatting, or put lots of IF functions into an already complex formula? Thank as always KK Use 2 cells Modify the complex formula to use B1 rather than A1 ( or any other un-u...

learning Excel #3
Hi, I was considering learning Excel as an additional tool for my data analysis work. Is it better to use data sets that I have previously used with SPSS and apply the same analysis tools as in SPSS? For applying the appropriate tools, I was considering using excel's online help. The second option I have is to use some excel book for data analysis and apply the techniques to data sets provided with the book. Any suggestions????? regards Metal ...

unable to paste Excel 2003 chart into Outlook 2003
(This was posted on "excel.charting" group.) I have a user who's unable to paste an Excel 2003 chart into Outlook 2003 email message. In Outlook options, the checkbox is selected for "Use Microsoft Office Word 2003 to edit e-mail messages". When I tested this on my own computer running the same version of Office, if the box is check, I have no problem pasting; if this box is cleared, I cannot paste. But on his computer, it doesn't work regardless. Thanks and regards, TL ...

number format with leading 0
Dose anyone know how to create a number format that would show a leading zero for the numbers 0-9. That is, so that 1 would show as 01. I can do with a text format but would like to retain the integrity of the number. Thanks Try this: Format>Cells>Number Category: Custom Type: 00 Click [OK] Does that help? *********** Regards, Ron "Darby" wrote: > Dose anyone know how to create a number format that would show a leading zero > for the numbers 0-9. That is, so that 1 would show as 01. I can do with a > text format but would like to retain the integrity...

Excel VBA
When you select the autofilter, the drop down list is created from the unique data in that column. Is there any way to customize this list, so the changes are permanent? For instance, I might have in one(1) column the following 4 row entries: red, blue, green (all are single cell entries) red, blue red blue, green I want my autofilter drop down list to read: red instead of red, blue, green blue red, blue green red blue, green (like normal) If I chose red from the drop down list...

Problem with named range for a large spreadsheet in Excel 2007
Hello, I am trying to generate a large Excel spreadsheet apprx. 10000 rows and 40 columns. I am generating defined name section in the Workbook.xml part of the XLSM package. Here is a sample entry from that section <definedName name="_._44802_._0_._0_._0_._top_line" localSheetId="0" hidden="1">Sheet1!$B$2</definedName> Although the generation goes fine, I can not open the spreadsheet as the Excel throws an error message saying the package is corrupt. But this is not the case if the spreadsheet is small say, 200 rows by 10 columns. ...

Fixing a formula to read a general format?
A few months ago I had asked a question and got this answer: Question: I have a a set of values in A1 through A100. I need to look up each value and find a match in another set of values located in C1 through C200. If a match is found then I need the formula located in column B to return the value in the same row but the next column over (D). Answer: =IF(ISNUMBER(VLOOKUP(A1,$C$1:$D$200,2,0)), VLOOKUP(A1,$C$1:$D$200,2,0), "") Copy down through A100. The formula worked fine, however the reference value and the look up value are not any more numbers but a combinatio...

how do I add error bars to a 3D chart in excel?
The help states you can only add error bars to data series in 2D area. Is there a way to add them to a 3D chart? Hi, I would not have thought so. Obviously as it is not a built-in option the only way would be a work around perhaps using dummy series. Unfortunately you can create 3d combination charts. Stick with the 2d view. Cheers Andy elahe wrote: > The help states you can only add error bars to data series in 2D area. Is > there a way to add them to a 3D chart? -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info I checked, and error bars are not offered for 3D ch...

Call & Place Graphic Based on Cell Value?
Is there any way to call & place a graphic image based upon a cell value? Maybe you can look at J.E. McGimpsey's page: http://www.mcgimpsey.com/excel/lookuppics.html documike wrote: > > Is there any way to call & place a graphic image based upon a cell value? -- Dave Peterson ...

Let me use the Line Color icon on charts
It would speed up a lot of my work if I could use the Line Color icon on Excel charts, the same way I am able to use the Fill Color and Font Color icons. However, when I highlight any chart object, like the Plot Area, Chart Area, or a Series, the Line Color icon is disabled. -- Stuart Bratesman, Jr., MPP Muskie School of Public Service Univ. of Southern Maine Portland, Maine ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If ...

q Emailing Excel Sheet With Outlook
I am trying to send a table from Excel within the body of an Outlook (lastest versions) to be sent as a fax. Am able to do this, BUT when the document prints out on the fax machine the formating is off (too big for the sheet). I am flexible on changing the method I send it to the fax machine, however it must be sent to the fax via macro. Below is the code I am using. Any help would be greatly appreciated. David Public Sub DoIt() 'On Error GoTo Handler Dim EmailAddress(0 To 2) As String Dim Count As Integer Dim N As Integer Dim sRec1(0) As String Dim sRec2(0 To 1) As...

I need to print a word in PDF from excel.
Hi, In my excel Macro, I update several values and then open a word linked with that excel. Finally what I need to do is to print that word to PDF. I already have a PDF Printer, so I just need the code to do it. Can anybody help me? Thanks in advance. Gast=F3n. Habilita la impresora predeterminada como la PDF y ya lo puedes imprimir a al formato deseado Gracias Francisco,=20 Tienes alg=FAn codigo para ello? gracias Repitiendo: Desde el panel de impresoras asigno primero la que me interesa y despues ejecuto mi macro desde el archivo excel asignando la instruccion sig: midefaultes = a...

Q:Excel/ODBC/Login ....
Hi' there ! My situation is this; My customer have a hole bunch of different Excel workbooks - with VB code inside. In this VB code the user/pwd to the ODBC connection is hardcoded. This hardcoding is not approved by audit. Is there any smart way (opposed the insert a login-dialogbox in each of those workbooks) - to solve this problem? What I thought of, is to make a button on my menubar to etablish the ODBC connection and regardless of wich workbook I open - hold this connection open. But somethins tells me, that the code should beplaced in a workbook - and not directly in Excel...