Link to home
Start Free TrialLog in
Avatar of ca1358
ca1358

asked on

Excel VBA

This is Excel VBA
1)I have this line, how do you compare both case, Example "tx" and "TX"
If Range("E" & x) = "tx" Then

I had this but I get an error of "Type Mismatch"
If Range("E" & x) = "tx" Or "TX" Then

And
2)For x = 25 To 2000
Is there a way to say row 25 - last row in "D", that has data

Any help would greatly be appreciated!!


This is the piece of code I am working on.
//////////////////////////////////

For x = 25 To 2000
If Range("E" & x) = "tx" Then
If Range("P" & x) = "YES" Then
Sheets("Data Input Sheet").Range("D" & x).Select
  Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
     With Selection.Interior
        .ColorIndex = 3
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
   End With
Else
End If
End If
Next
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

If ucase(Range("E" & x)) = "TX" Then
For x = 25 To usedrange.rows.count
Avatar of ca1358
ca1358

ASKER

This worked   If ucase(Range("E" & x)) = "TX" Then

Thank you

But this gives me a Runtime error of 424 - object required.

For x = 25 To usedrange.rows.count


ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ca1358

ASKER

Thank you!