Lets say now i want to use Select Case For some purposes as shown below:

Here, i have two arrays, One is called strmac() and another one is mac().

strmac() is used to store the variable read from the database, it is used to read the Machine ID for example.

mac() is an array used to read the machine ID as well from the INI file.

For example, if lets say i want to loop through the database, first of all i need to go through the INI file first. If mac() has 3 elements of 123,134,144, then only these 3 machine ID will be selected when it read through the database.


Do While Not rs.EOF()
Select Case (strmac)
Case " mac(0) "
'Split it to 24 hours so that i can get the quantity for each hour
Case " mac(1) "
'Do whatever code here

The problem is, the code is very long because within each case, i still have many calculations and array which is used to store the count for each hour and it just follow some kind of format. And the size of mac() may changes time to time? Any concern to get it simpler? Thanks.....

You could make each case it's own function

Case mac(0)


Case mac(1)


End Sub..

Public Sub RT_Mac_0

   Do whatever you want

End Sub

Public Sub RT_Mac_1

   Do whatever you want

End Sub

Make sense?