Hi
Have another issue:
I have a formula in column D =TRIM(E)
Also I need to remove duplicated values in the sheet based on D column, however when I run remove duplicates macro - all of my formulas are being removed as well.
I have been offered to try the following code:
Sub Remove_duplicates()
Add_Unique (ActiveSheet.range("E2:E2000")<wbr>)
Rows("2:2000").Select
range("BM2").Activate
ActiveSheet.range("$A$2:$CG$<wbr>2000").RemoveDuplicates Columns:=5, Header:=xlNo
range("A2").Select
Remove_Unique (ActiveSheet.range("E2:E2000")<wbr>)
End Sub
Sub Add_Unique(range As range)
Application.ScreenUpdating = False
Dim uniqueValue As Integer
For Each c In range
If c.Value = "" Then
uniqueValue = uniqueValue - 1
c.FormulaR1C1 = uniqueValue
End If
Next c
End Sub
Sub Remove_Unique(range As range)
Dim uniqueValue As Integer
For Each c In range
If c.Value < 0 Then
c.FormulaR1C1 = ""
End If
Next c
Application.ScreenUpdating = True
End Sub
But it doesn't work..
Any suggestions how to fix the issue?
Thank you
Have another issue:
I have a formula in column D =TRIM(E)
Also I need to remove duplicated values in the sheet based on D column, however when I run remove duplicates macro - all of my formulas are being removed as well.
I have been offered to try the following code:
Sub Remove_duplicates()
Add_Unique (ActiveSheet.range("E2:E2000")<wbr>)
Rows("2:2000").Select
range("BM2").Activate
ActiveSheet.range("$A$2:$CG$<wbr>2000").RemoveDuplicates Columns:=5, Header:=xlNo
range("A2").Select
Remove_Unique (ActiveSheet.range("E2:E2000")<wbr>)
End Sub
Sub Add_Unique(range As range)
Application.ScreenUpdating = False
Dim uniqueValue As Integer
For Each c In range
If c.Value = "" Then
uniqueValue = uniqueValue - 1
c.FormulaR1C1 = uniqueValue
End If
Next c
End Sub
Sub Remove_Unique(range As range)
Dim uniqueValue As Integer
For Each c In range
If c.Value < 0 Then
c.FormulaR1C1 = ""
End If
Next c
Application.ScreenUpdating = True
End Sub
But it doesn't work..
Any suggestions how to fix the issue?
Thank you