ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Is this possible??? (https://www.excelbanter.com/excel-programming/386825-possible.html)

Peter[_61_]

Is this possible???
 
specialmerchants = InStr(1, mername, m(0) Or m(1) Or m(2) Or m(3) Or
m(4) Or m(5) Or m(6) Or m(7))

if specialmerchants = true then...


Obviously this doesn't work but you can see what I'm trying to do, is
there a way to make it work?

Thanks,

Peter


joel

Is this possible???
 
This is the bestt way of coding your problem

Sub getmerchants()

Dim m(5) As String

m(0) = "John"
m(1) = "Bob"
m(2) = "Nick"
m(3) = "Steve"
m(4) = "Peter"

mername = "Peter Smith"
specialmerchants = ""
For Each myname In m

If InStr(mername, myname) 0 Then
specialmerchants = myname
Exit For
End If
Next myname


End Sub


"Peter" wrote:

specialmerchants = InStr(1, mername, m(0) Or m(1) Or m(2) Or m(3) Or
m(4) Or m(5) Or m(6) Or m(7))

if specialmerchants = true then...


Obviously this doesn't work but you can see what I'm trying to do, is
there a way to make it work?

Thanks,

Peter




All times are GMT +1. The time now is 06:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com