Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50031

Loop and find specific value or misc value, if misc then not equal to certain values

$
0
0
this is working fine however, if rr = "misc" then the macro should look for all ccode values not equal to "0305", "0385" or "0399", not quite sure how to code that

I get the rr value with the code below:

Code:

If ms.Buttons(Application.Caller).Name = "recs0305" Then rr = "0305"
 If ms.Buttons(Application.Caller).Name = "recs0385" Then rr = "0385"
 If ms.Buttons(Application.Caller).Name = "recs0399" Then rr = "0399"
 If ms.Buttons(Application.Caller).Name = "recsmisc" Then rr = "misc"

there is a loop that loops through values in the B colum where rev is a worksheet
if rr = misc then I want it to pull all values that are NOT "0305", "0385", or "0399"

Code:

ccode = Left(rev.Range("B" & Lrow).Value, 4)
If .Value <> "" And ccode = rr Then


any insight would be appreciated

Viewing all articles
Browse latest Browse all 50031

Trending Articles