Results 1 to 5 of 5

Macro returning string, while i want array

Threaded View

  1. #1
    Registered User
    Join Date
    02-02-2010
    Location
    Providence, Rhode Island
    MS-Off Ver
    Excel 2003
    Posts
    2

    Macro returning string, while i want array

    Hi!

    My problem started when i was trying to get a VLookup to return mulitple values. For example, I wanted it to return every value that had the word "YES" beside it. But, as we all know, once a VLookup finds the lookup value, it stops searching.

    I then discovered a macro that will return multiple values based on a given criteria. It is:

    Public Function FindSeries(TRange As Range, MatchWith As String)
         
        For Each cell In TRange
            If cell.Value = MatchWith Then
                x = x & cell.Offset(0, 1).Value & ", "
            End If
        Next cell
         
        FindSeries = Left(x, (Len(x) - 2))
         
    End Function

    However, it is returning all the value as a string in the same cell separated by commas! I want it to return each value into a new cell (preferrably going vertically). I'm sure there must be an easy manipulation to this macro to make it return each value in its own cell, rather than as a string. Please help!!!


    Thank you so much
    Last edited by DanceFanatic707; 03-01-2010 at 02:30 PM.

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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