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

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(xlInside

With Selection.Interior

.ColorIndex = 3

.Pattern = xlSolid

.PatternColorIndex = xlAutomatic

End With

Else

End If

End If

Next

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

For x = 25 To usedrange.rows.count

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

Thank you

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

For x = 25 To usedrange.rows.count

ASKER CERTIFIED SOLUTION

membership

This solution is only available to members.

To access this solution, you must be a member of Experts Exchange.

ASKER

Thank you!