Quote:
Originally Posted by Jennifer Murphy
I'm not sure which code you are referencing.
|
The code I supplied in post #21.
Quote:
Originally Posted by Jennifer Murphy
In the code I am working on, the keyword parameters can be written in any order. That's the whole purpose of keyword parameters, no?. If they must be in a specific order, there is little need for the keywords. They can just be coded as values:
Parms: 3, 215, 199, 244, 0
|
That code was based on your original specification:
Quote:
Originally Posted by Jennifer Murphy
Parms: Col=3, Hdrs=0, RGB=215,199,244
|
and
requires each parameter to be preceded by '=' and, except for the last, to be followed by ','. The order in which they occur is critical - regardless of whether you supply the keywords (which aren't actually necessary for the parsing). For example, the code cannot possibly know which is the column and the row if you use:
3, 1, 215, 199, 244
or:
1, 3, 215, 199, 244
unless you stick to a specified order. Yes, you could just pass a string of numbers separated by whatever character you choose (e.g. just a space or a comma) but, even so, the order would remain critical.
Quote:
Originally Posted by Jennifer Murphy
And in my code, all of them have defaults, so none of them are required. I loop through them one by one using a Case statement to determine which keyword it is and then process the value.
|
It seems you're using something different from what we've discussed. It's a bit hard to develop code if you're shifting the goal posts like that.
Quote:
Originally Posted by Jennifer Murphy
That's an interesting and clever way to do that. At first it looked odd to me, but I see that it avoids having to test for i > UBound at each step and then having a label to Go To or messy nested If statements.
But I've never seen a Case statement coded like that. It's always:
Code:
Select Case i
Case 0: C = Trim(Split(Split(StrParms, "=")(1), ",")(0))
Case 1: StrRGB = Trim(Split(Split(StrParms, "=")(2), ",")(0))
Case 2: Hdr = Trim(Split(StrParms, "=")(3))
End Select
|
It can be coded either way. The only reason for having the loop & select case statement, though, is to cater for:
Quote:
Originally Posted by Jennifer Murphy
I think I'll include the Headers=n parameter. If it's present, I'll use it. If not, I'll check for the Repeat option and use that. If neither are present, I'll assume no headers and start highlighting with row 1
|
which means one parameter has become optional and, so, a way is needed to test for its presence.