Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Finding Duplicate Entries - Saving Worksheet if none found
Hi there
Hope someone can help me with this. I currently have the following code that searches column for duplicate entries and highlights them: Sub FindDuplicate() On Error GoTo Merr Dim kr As String ColNameIn = "C" If Len(ColNameIn) = 0 Then Exit Sub Range(ColNameIn & 1).Activate For A = 1 To 200 Range(ColNameIn & A).Activate If ActiveCell.Value = kr Then ActiveCell.Font.Bold = True Selection.Interior.ColorIndex = 6 MsgBox "There are duplicate trade references. Please discuss with Business Support" Else End If If Len(ActiveCell.Value) = 0 Then MsgBox "Finished Data Check", vbOKOnly + vbInformation, "Reporting" Exit Sub End If kr = ActiveCell.Value Next A Exit Sub Merr: MsgBox Err.Description End Sub It works perfectly. However, what I need to happen, is, if no duplicate records are found, for the following code to be invoked: Worksheets("Cleaned Results").Copy Set wb = ActiveWorkbook wb.SaveAs "C:\New Report" & Month(Range("F2").Value) & Day(Range("F2").Value) & Year(Range("F2").Value) & ".csv" wb.Close If duplicate records are found, I want the sub to end so that the user can fix these issues. Would be so grateful for some help with this. Thanks Paul |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Finding Duplicate Entries | Excel Worksheet Functions | |||
Finding duplicate entries | Excel Worksheet Functions | |||
Finding Duplicate Entries | Excel Discussion (Misc queries) | |||
Need help with finding duplicate entries | Excel Worksheet Functions | |||
finding duplicate entries | Excel Programming |