Results 1 to 8 of 8

calling Subroutine is not working properly

Threaded View

  1. #1
    Registered User
    Join Date
    10-30-2012
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    92

    calling Subroutine is not working properly

    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....
    Last edited by arlu1201; 11-04-2012 at 10:02 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1