Excel VBA - Check cells in a column do not contain the string 8254 and display MsgBox -


i trying put vba code check if contents in every cell l2 down last row of data (until blank cell found) not contain string '8254' number codes in column l 27 characters long , contain '8254' last 4 digits. if can verify '8254' in every cell format/code correct (some number codes incorrect , need investigated). if string '8254' not present in 1 or more of cells, display msgbox warning there error(s) in column.

i have been trying make below code work, new vba , need help

does know how can this?

thanks

sub checkcodes()  'check column 'l' non standard number codes dim code range   each code in range("l2", range("l" & rows.count).end(xlup))     if vba.right$(vba.trim$(code), 4) <> "8254"         msgbox "non standard number codes found!  " & vbnewline & "check number codes  ", , "advisory!"         exit sub     end if next code end sub 

i found issue code checking number of blank cells down line l1000 , causing issue. modified per below checks bottom of data , working fine. kind , comments.

sub checkcodes()  'check column 'l' non standard number codes dim code range   each code in range("l2", range("l" & rows.count).end(xlup))     if vba.right$(vba.trim$(code), 4) <> "8254"         msgbox "non standard number codes found!  " & vbnewline & "check number codes  ", , "advisory!"     exit sub end if next code end sub 

Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -