i have wrriten a macro for calling a subroutine.
eg:
Sub Perilthree_CountOSUS()
Dim cl As Range, UniqueValues As New Collection
' Application.Volatile
On Error Resume Next ' ignore any errors
Sheets("OSUS Extract").Range("F1").AutoFilter Field:=6, Criteria1:=3
For Each cl In Sheets("OSUS Extract").Range("j3:j3000")
If cl.Rows.Hidden = False Then
If cl.Columns.Hidden = False Then
UniqueValues.Add cl.Value, CStr(cl.Value) ' add the unique item
End If
End If
Next cl
On Error GoTo 0
Sheets("Output sheet").Range("h18").Value = UniqueValues.Count - 1
End Sub
when i call Perilthree_CountOSUS subroutine from different location or another subroutine i am getting result as zero in h18 location where as when i run the subroutine individually i got the correct result.
can anybody let me know where the problem is...
i was really doesn't know why it is producing different results when calling differently..
Its very urgent....
Bookmarks