Question : Load Array Values from Range of Cells and Exit If condition Met, Otherwise go to Next Sub

Experts,

I have a few questions regarding an array (See code below).

1. How could I load the array values from a range of cells? The values for the array are located on Sheet “Summary” in Range D8:D28, however I would like to code this as D8:D? where ? is the last row, something like End.(x1Down). This way if values change (more are added or removed) the arrays values will change dynamically. Normally this is not an issue as I only have 3-4 values, so (“value1”, “value2”, … “valueN”) isn’t that confusing, but with ~20 values, I figured there has to be a better way to do it more efficiently.

Do I have to take each value and enclose it within the " ", ?

2. As it stands the code works fine, it finds any cell(s) Sheet(Temp Data) range C2:C(last row) that are not a match to the listed values. But how can I say the following:

If no cells in the range C2:C(lastrow) equal Cell.Interior.ColorIndex = 6
go on to private sub SomeOtherSub ()

If any cell(s) equal Cell.Interior.ColorIndex = 6, then select the first entry (making this the active cell) and exit all together.

So if C5, C6, C12 and C20 are highlighted yellow (as in my attached example workbook, after executing the code), then go to the first cell (C5) in this example, select that cell and exit. Then someone would fix these errors, run it again (it should pass this time, as all cells should have the correct array values) and then it goes on to the next sub.

Thank you,
Kevin
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
Sub CheckForNames()
 
 Sheets("Temp Data").Activate
 
     For Each Cell In Range([C2], [C2].End(xlDown))
        If IsError(Application.Match(Cell, Array("AH1", "BKT", "BMM", "DJG", "DJM", "EMD", "FDI", "HF1", "INN", "KAH", "LAR", "LOA", "LRO", "MCA", "MCJ", "PAS", "PAT", "RMH", "SM", "STL", "WHG"), 0)) Then
            Cell.Interior.ColorIndex = 6
        End If
    Next Cell
 
 End Sub
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
Sub CheckForNames()
 
 Sheets("Temp Data").Activate
 
     For Each Cell In Range([C2], [C2].End(xlDown))
        If IsError(Application.Match(Cell, Array("AH1", "BKT", "BMM", "DJG", "DJM", "EMD", "FDI", "HF1", "INN", "KAH", "LAR", "LOA", "LRO", "MCA", "MCJ", "PAS", "PAT", "RMH", "SM", "STL", "WHG"), 0)) Then
            Cell.Interior.ColorIndex = 6
        End If
    Next Cell
 
 End Sub
Attachments:
 
ColorTest_ByArrayNames
 

Answer : Load Array Values from Range of Cells and Exit If condition Met, Otherwise go to Next Sub

>This is what I was referring to http://support.microsoft.com/kb/912309

EXCELLENT link - hadn't seen that before.  R2 REQUIRES SP1 for 2003 be installed.  Since Service Packs are GENERALLY (and for server 2003 ARE) cumulative, addressing SP2 as well should be, strictly speaking, unnecessary.  That said, I've complained to MS in the past that they should at least put such footnotes in the document.

>>Not really sure what issues you are expecting...

>Well, having everything at the exact same patch/version level never hurts.
Agreed.


> I can't seem to find it right now, but there is always the potential for issues
Agreed.  There is always the potential for issues.  But that can be said about anything.  And, strictly speaking, most consultants will tell you not to upgrade.  Do a clean install.  It's safer that way.  Microsoft has to provide upgrade capability because not doing so what be worse than if Microsoft suddenly insisted you could only use Dell to run Windows software.  (You know, the same way Apple insists you can only use Apple hardware to run MacOS - they get away with it - Microsoft would be beaten about the head until it was dead... and then beaten some more if they tried what Apple does).

http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Server/2003_Server/Q_24888751.html?sfQueryTermInfo=1+10+2003+30+r2+upgrad
In this instance, it's unclear what happened to me... I suspect they tried using the wrong media type... but frankly, I don't buy OEM anymore - Volume Licenses may be a little more money, but they provide the flexibility in that once you have them, your business can move the software to any other system.  Buy OEM and the software dies with the hardware you got it with... to me, THAT is a waste of money in most cases.

http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Server/SBS_Small_Business_Server/Q_23450787.html?sfQueryTermInfo=1+10+2003+30+r2+upgrad
Not applicable.  This is an SBS install.  That's an entirely different beast and it even seems that it was installed wrong to begin with, so the fact there are problems aren't surprising.  Setting up SBS should be done by knowledgeable and experienced people to ensure it's done right.  The company staff can manage it easily afterward... but if they set it up wrong, the chaos and expense that can follow can be great.


>> All that said, the SMART thing to do is setup a test system or two and TEST
>> it yourself to see what happens.  Also, ALWAYS, make backups of all your
>> systems/system states prior to any major upgrade.

> Yeah, that's all fine and dandy unless you're talking about a small company
> with a smaller budget and no spare equipment even close to being able to
> install 2003 Server on, let alone build a test environment of any sort.

Why use hardware?  That's such a pain to run a test environment off hardware... you'd have to take images and reverting the images is a pain in terms of time and effort.  Use virtualization - ZERO hardware cost for basic testing.  MINOR hardware cost (RAM) for extensive testing.  So not having hardware is no excuse to me.  Virtualization lets you take "snapshots" of configurations and easily revert them.  Virtualization is also largely free - Virtual PC is free, ESXi is free, HyperV is free.  VMWare server is Free.  Virtual Iron, Xen, and many other options exist as well.  There really is no reason you can't test this first.

> Oh yeah, this is also at their remote office which is a seperate domain that they don't do backups of.
Then I think you're doing this in wrong order of priority.  If they are willing to spend the time and money upgrading to R2, they should be implementing a backup solution.  Disparate systems (especially when they run Windows) is not nearly that much of an issue compared to no backups which is unwise at best.

Further, for testing, $250-350 - get a technet Plus Direct subscription.  Provides copies of all Windows software for testing and evaluation purposes with no time limits.
Random Solutions  
 
programming4us programming4us