LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 852
Default If value occurs more than once then delete all of them

If a value in varData occurs more than once, then delete all same values in varData and list remaining values in column F.

Values as either Integers or text or both, if possible.

This code does not like the CountIf.

Thanks.
Howard


Sub LoneValueStay()
Dim varData As Variant
Dim i As Long

varData = Sheets("Sheet1").Range("A2:D15") '// Read in the data.

For i = LBound(varData) To UBound(varData)
If Application.WorksheetFunction.CountIf(varData(i, varData)) 1 Then
varData(i) = ""
'varData(i).Delete
End If
Next i

'// Write result to sheet.
'Sheets("Sheet1").Range("F1").Resize(UBound(varDat a) - LBound(varData) + 1, 1) _
= varData
End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
if number occurs twice ekkeindoha Excel Discussion (Misc queries) 1 September 25th 07 12:14 PM
How to calculate the Date occurs Blue Fish Excel Worksheet Functions 2 July 26th 07 10:42 AM
MsgBox when an Error occurs Vick Excel Discussion (Misc queries) 1 December 21st 05 08:48 PM
How can I add up how often certain text occurs? Martin M Excel Worksheet Functions 3 June 17th 05 10:00 PM
Counting times a value occurs Jordan Excel Programming 1 May 6th 05 06:44 PM


All times are GMT +1. The time now is 06:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"