Results 1 to 2 of 2

Thread: [RESOLVED] Collate common values

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2006
    Location
    London, UK
    Posts
    817

    Resolved [RESOLVED] Collate common values

    I have hundreds of variables and need to see if they are duplicated.
    Is there a simple function I can use to achieve this rather than repeating the code for each? The variables have different types. Can you pass a variable name into a subroutine?

    Code:
        Sub CheckDuplicate(ByRef Variable As Object, ByVal value As Object)
            'see if it is already duplicated
            If Variable <> "Varies" Then
                'if not see if it exists and a duplicate
                If Variable <> value Then
                    'if not then add it
                    Variable = value
                Else
                    'if it is a duplicate then return varies
                    Variable = "Varies"
                End If
            End If
        End Sub
    Last edited by sgrya1; Aug 31st, 2011 at 03:03 PM.

  2. #2

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2006
    Location
    London, UK
    Posts
    817

    Re: Collate common values

    What I had looks like it works. I put it together as a fuzzy example of what I was trying to achieve.
    I just needed to check the types of variables and return a Varying result accordingly.
    If TypeOf Variable Is String Then
    Sorry.
    Last edited by sgrya1; Sep 1st, 2011 at 03:28 AM.

Posting Permissions

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



Click Here to Expand Forum to Full Width