![]() |
better way
Hi, is ther a better way of writing this.
If r = "K" And i = 2 Or r = "Q" And i = 2 Or r = "J" And i = 2 Then r1 = 10 + i y = i x = 112 end if. As you can see i always = 2 but r can be a k,q, or j. This way works perfect, just thinking that there may be a better way. I was thinking something like if r = k/q/j. regards Robert |
better way
If i=2 And InStr("KQJ",r)0 Then
r1=.... etc End If NickHK wrote in message oups.com... Hi, is ther a better way of writing this. If r = "K" And i = 2 Or r = "Q" And i = 2 Or r = "J" And i = 2 Then r1 = 10 + i y = i x = 112 end if. As you can see i always = 2 but r can be a k,q, or j. This way works perfect, just thinking that there may be a better way. I was thinking something like if r = k/q/j. regards Robert |
better way
Hello,
NickHK wrote: If i=2 And InStr("KQJ",r)0 Then Sorry, that's more than the OP wants. This is TRUE for r="K", "Q", "J", "KQ", "QJ" and "KQJ" (and i=2, of course) Regards, Bernd |
better way
Depends what are possible values for r.
If i=2 And InStr("KQJ",Left(r,1))0 Then Better. NickHK wrote in message ups.com... Hello, NickHK wrote: If i=2 And InStr("KQJ",r)0 Then Sorry, that's more than the OP wants. This is TRUE for r="K", "Q", "J", "KQ", "QJ" and "KQJ" (and i=2, of course) Regards, Bernd |
better way
Hello,
Sorry, no. This would accept any r starting with "K", "Q" or "J" (i being 2). Maybe If i = 2 And Application.WorksheetFunction.Match(r, _ Array("K", "Q", "J", r), False) < 4 Then ... End If or just If i=2 and (r="K" or r="Q" or r="J") then ... end if Regards, Bernd |
better way
Thankyou for your replys. I trying both ideas.
Regards Robert |
All times are GMT +1. The time now is 04:31 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com