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 macro doesn't compile after module crashed continued from scary th

Sorry but I tried this macro in another module and it still doesn't compile.
I think something that was saved before got changed due to a file that wasn't
recovered properly. So can someone find out what little bitty thing is
missing? I know it works. I remember I had to change one thing to get it to
work and I don't know if that is the old version now.

thanks,
Sub ckForDupes()

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

Set Rng = Range("B1", Range("B65536").End(xlUp))


For Each cell In Rng
v = MACSplit(cell.Text, ",")
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"
cell.Interior.ColorIndex = 3

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
compile error in hidden module Gary M Excel Discussion (Misc queries) 0 July 31st 07 09:22 PM
Compile error in hidden module Chris Reynolds Excel Discussion (Misc queries) 3 March 10th 06 07:11 PM
Compile error in hidden module arjay Excel Discussion (Misc queries) 5 September 16th 05 12:47 AM
Can't compile, module empty? davegb Excel Programming 2 June 29th 05 06:51 PM
Compile error in hidden module Paul Excel Programming 3 November 17th 03 09:56 PM


All times are GMT +1. The time now is 05:31 PM.

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

About Us

"It's about Microsoft Excel"