View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
[email protected] paul.robinson@it-tallaght.ie is offline
external usenet poster
 
Posts: 789
Default Macro Issue with loop

Hi
Try this. Untested and I'm a bit worried about the last Set myName
statement but havn't the time to check it.
regards
Paul
Sub deleteDuplicates()
Dim myName As Range 'Name column
Dim myData as String, nextData as String, i as integer
Set myName = Range("C2")

With myName
Do While Trim(.Value)<""
myData = ""
For i = 0 to 3
myData = myData & Trim(lcase(.offset(0,i).Value))
next i
nextdata = ""
For i = 0 to 3
nextData = nextData & Trim(lcase(.offset(1,i).Value))
next i
'Check data
If myData = nextData then
.offset(1,0).EntireRow.Delete
Else
Set myName = .offset(1,0)
End If
Loop
End With 'myName
End Sub


Dileep Chandran wrote:

Hi Paul,

While checking for duplicates, this macro is not considering data as
duplicate if one is in lower case and other is in upper case.

Can you help me out to overcome this issue?

-Dileep