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: 360
Default split function for Excel 2003

I got this split function which all works well. Thanks. I need write the
v(nth) iterations to another column so I can see the individual dupes it that
is possible. Right now it very nicely colors the whole cell where a dupe is
found but I would love to have the individual values stored somewhere instead
of flashing by in the message box. Thanks for any ideas,

Dim rng As Range, cell As Range
Dim i As Long, c1 As Long
Dim v

Set rng = Range("D1", Range("D65536").End(xlUp))


For Each cell In rng
v = MACSplit(cell.Text, ",")
Debug.Print "v:"; v
For i = LBound(v) To UBound(v)
c1 = Application.CountIf(rng, "*" & v(i) & "*")
If c1 1 Then ' it should be 1 to match itself
MsgBox v(i) & " :possible dups"

Debug.Print "v(i): ("; i; ")"; v(i)
'c1.Font.ColorIndex = 50
End If
Next
Next

End Sub
Function MACSplit(s As String, s3 As String)
Dim v As Variant, sChr As String
Dim S1 As String, s2 As String
Dim cnt As Long
Dim i
ReDim v(0 To 0)
S1 = Trim(s)
s2 = ""
If InStr(1, S1, s3, vbTextCompare) = 0 Then
v(0) = S1
MACSplit = v
Exit Function
End If
cnt = -1
For i = 1 To Len(S1)
sChr = Mid(S1, i, 1)
If sChr = s3 Then
cnt = cnt + 1
ReDim Preserve v(0 To cnt)
v(UBound(v)) = s2
s2 = ""

Else
s2 = s2 & sChr
End If
Next
If s2 < "" And s2 < s3 Then
cnt = cnt + 1
ReDim Preserve v(0 To cnt)
v(UBound(v)) = s2
End If
MACSplit = v
End Function



 
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
Excel 2003 split screen Chip Smith Excel Discussion (Misc queries) 0 August 4th 06 12:21 AM
Freeze and split panes in Excel 2003 John Excel Worksheet Functions 2 January 31st 06 10:43 PM
How do I Remove a Split from my Comments in Excel 2003? JesusPresley Excel Discussion (Misc queries) 1 October 6th 05 07:59 PM
How do I Remove a Split from my Comments in Excel 2003? JesusPresley Excel Discussion (Misc queries) 0 October 6th 05 06:54 PM


All times are GMT +1. The time now is 02:45 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"