• Hot Topics

Excel Creating a "duplicate found msg" in VBA

I am very, very new to programming in VBA. I have come up with the following code for VBA. But, it doesn't work. I can still enter a duplicate. Can someone please share with me what I'm doing wrong? If Trim(Me.txtheatcode.Value) = "" Then MsgBox "Please enter a Heat Code" If Trim(Me.txtheatcode.Value) = (Sheets("PartsData").Range("D2:D999")) = 0 Then MsgBox "Duplicate Heat Code Found" Me.txtheatcode.SetFocus End If Thank you for your time.

This question generated 15 answers. To proceed to the answers, click here.

This thread is current as of May 12, 2015.

For more resources for Microsoft Excel:

This article includes the following tags:

  • Excel
  • Microsoft Excel

privacy policy