Avatar of 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

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
End If
End If
Visual Basic Classic

Avatar of undefined
Last Comment

8/22/2022 - Mon
Guy Hengel [angelIII / a3]

If ucase(Range("E" & x)) = "TX" Then
Guy Hengel [angelIII / a3]

For x = 25 To usedrange.rows.count

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

Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Guy Hengel [angelIII / a3]

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

Thank you!