MassSpecGuru
Board Regular
- Joined
- Feb 23, 2010
- Messages
- 55
I would like to develop some VBA code for the evaluation, and if "improperly entered"the replacement, of certain values in the first column of a worksheet.
Ultimately, I would like to test for four different situations, however, if pointed in the right direction, I could probably expand upon the one-case scenario myself (fingers crossed), but an example of what I would like to accomlish is this:
If the value in a cell is a number then return that number, otherwise check to see if it is, say, "QL"* (case sensitive). If it is only "QX" both capital letters), then return that value, too.
The "problem" comes in where I want to evaluate other possible entries such as: "Q l" (or q l) "Qlow", "QCL", "QCLOW", "qc_low", "QC-low" (or in this instance, any other variations/combinations you can dream up using the letters, both upper and lower case, q, c, b, l, a, n, k, as well as any "space-type" characters like <SPACE>, hyphen, dash.)
Basically, what I see as the key to this task is whether or not there is a "b", "l" (el), "m" or "h" somwhere in the cell. The "difficulty" increases though because the possibility if a cell containing, say, (ignoring case and just focusing on the letters involved) "qc blank", or "qcblk" or "qcbl" versus a cell containing "qcl" or "qc low" of just "q low". I guess you could check for the "b" first here and then move on, so maybe a Case construction would be in order?
Can anybody come up with some suggestions, or code , to getting this going?
Thanks for your input!
* where "X" would be either "B", "L", "M" or "H", thus the other three instances we're checking for are: "QB", "QM" and "QH".
Ultimately, I would like to test for four different situations, however, if pointed in the right direction, I could probably expand upon the one-case scenario myself (fingers crossed), but an example of what I would like to accomlish is this:
If the value in a cell is a number then return that number, otherwise check to see if it is, say, "QL"* (case sensitive). If it is only "QX" both capital letters), then return that value, too.
The "problem" comes in where I want to evaluate other possible entries such as: "Q l" (or q l) "Qlow", "QCL", "QCLOW", "qc_low", "QC-low" (or in this instance, any other variations/combinations you can dream up using the letters, both upper and lower case, q, c, b, l, a, n, k, as well as any "space-type" characters like <SPACE>, hyphen, dash.)
Basically, what I see as the key to this task is whether or not there is a "b", "l" (el), "m" or "h" somwhere in the cell. The "difficulty" increases though because the possibility if a cell containing, say, (ignoring case and just focusing on the letters involved) "qc blank", or "qcblk" or "qcbl" versus a cell containing "qcl" or "qc low" of just "q low". I guess you could check for the "b" first here and then move on, so maybe a Case construction would be in order?
Can anybody come up with some suggestions, or code , to getting this going?
Thanks for your input!
* where "X" would be either "B", "L", "M" or "H", thus the other three instances we're checking for are: "QB", "QM" and "QH".