Unanswered: Could someone enlighten me about "Option Compare Text"?
I have this formatting macro that well deletes stuff, highlights a row based on certain arguments, etc. I know Option Compare Text makes a module case insensitive, I was wondering if this ability extends to the arguments for Nested Ifs & Cases w/in that module. Since I need to make the arguments case insensitive. Ex. If "Tax" = "TAX" = "tax", delete the entire row...
I have never used Option Compare Text for this purpose or any purpose. Using the text functions "uCase" or "lCase" are good way to avoid case problems when comparing text. Here's an example.
Public Sub checkRows()
nRow = 25
For i = nRow To 2 Step -1
bMatch = (UCase(Cells(i, 1)) = UCase(Cells(i, 2)))
If bMatch Then
Notice in the example I used 'Step -1' argument of the 'For' Loop to work backwards through the range. This way when a row is deleted it is not necessary to re-define the range because the subsequent row numbers have changed when the row has been deleted.
Normally I would use a function or statement to assign the last row number of the used range to the variable 'nRow' however for this simple example I just assigned the variable a number.
It doesn't make a difference if LCase or UCase funtion is used. The purpose is to ensure values are compared without a difference in case.