Is there an If Or Then statement?

  • Thread starter Thread starter bramnizzle
  • Start date Start date
B

bramnizzle

I'm trying to make this work but I get a Type Mismatch error. Any
clues?

If strFrequency = "ea pay" Or "each pay" Or "Bi Weekly" Or "Bi-Weekly"
Or "BI WEEKLY" Or "BI-WEEKLY" Or "bi weekly" Or "bi-weekly" Or "EA
PAY" Or "EACH PAY" Or "Ea Pay" Or "Each Pay" Then
Range("D11") = lAmount * 2
Else
Range("D11") = lAmount
End If
 
2 things

1.) you have to tell excel what you compare everytime

2.) you can use LCase to change the case of all the
Letters in strFrequency to lower case, so you won't
have any problems with case sensitivity.

If LCase(strFrequency) = "ea pay" Or _
LCase(strFrequency) = "each pay" Or _
LCase(strFrequency) = "bi weekly" Or _
LCase(strFrequency) = "bi-weekly" Then
Range("D11") = lAmount * 2
Else
Range("D11") = lAmount
End If

I put the _ after the lines in order to avoid word wrap.
If you want it one whole line, just delete the _ and put
it back together.

hth
Carlo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top