• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

skip to next if cell value is blank in the for loop

ajaar

Member
Hi Friends,

I managed to write a code to loop and find duplicates, it works if 'curcell' not blank. I wanted to skip to the next if 'curcell' value is blank. Any help please.
I tried to add ' if curcell <> "" then ', didnt succeed.

Code:
Sub check()
For counter = 4 To 82
  
  Set curcell = Sheet5.Cells(counter, 10)
  
  If curcell.Value = curcell.Offset(0, -5).Value Then dname = curcell.Offset(0, -5).Value
  
Next counter
  If dname <> "" Then
  MsgBox "duplicate" & dname
  End If
  End If
 
End Sub

Thanks
Ajaar
 

Hi,

easier could be to not use a code but just conditional formatting
highlighting duplicate cells with Excel COUNTIF worksheet function …
 
Back
Top