Results 1 to 8 of 8

Add one array to another array

Threaded View

Foreverlearning Add one array to another array 05-16-2012, 03:42 AM
StevenM Re: Add one array to another... 05-16-2012, 05:34 AM
nilem Re: Add one array to another... 05-16-2012, 05:50 AM
Foreverlearning Re: Add one array to another... 05-16-2012, 06:21 AM
nilem Re: Add one array to another... 05-16-2012, 09:16 AM
Foreverlearning Re: Add one array to another... 05-17-2012, 01:34 AM
nilem Re: Add one array to another... 05-17-2012, 02:08 AM
Foreverlearning Re: Add one array to another... 05-17-2012, 02:52 AM
  1. #1
    Forum Contributor
    Join Date
    06-16-2010
    Location
    Australia
    MS-Off Ver
    Excel 2007; Excel 2010
    Posts
    178

    Add one array to another array

    Hi,

    I am still just not getting it.
    I have a range on one sheet which I have added to an array and another range on another sheet added to an array
    If value in array matches value in 2nd array I want to add that value to a 3rd array.
    Just getting stumped here.

    This is what I have to date..
    Sub Count_Names()
    Dim vaRoster() As Variant, vaNames() As Variant, vaPNames() As Variant, vaCNames() As Variant
    Dim ln As Long, lm As Long
    Dim l As Long, m As Long, vaCount As Integer
    
        vaRoster = ActiveSheet.Range("C5:D24").Value
        vaNames = Sheets("Name_Matrix").Range("B5:C68").Value
        
        ReDim Preserve vaPNames(UBound(vaNames) + 1)
        
        For ln = LBound(vaNames, 1) To UBound(vaNames, 1)
            If vaNames(ln, 1) = "P" Then
                vaPNames() = vaNames(ln, 2)
            End If
        Next ln
        
        
        For l = LBound(vaRoster, 1) To UBound(vaRoster, 1)
            For m = LBound(vaRoster, 2) To UBound(vaRoster, 2)
                If vaRoster(l, m) <> "" Then vaCount = vaCount + 1
            Next m
        Next l
    
        MsgBox vaCount
    Thanks for your time

    Lionel
    Last edited by Foreverlearning; 05-17-2012 at 02:53 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