+ Reply to Thread
Results 1 to 2 of 2

Good but not enough

  1. #1
    Registered User
    Join Date
    08-01-2006
    Posts
    38

    Good but not enough

    This code:

    Set RngColD = Range("D2", Range("D" & Rows.Count).End(xlUp))

    For j = 900 To 954
    Info = ""
    For Each i In RngColD
    If i.Value = Range("A" & j).Value Then
    If Info = "" Then
    Info = i.Offset(, 12).Value
    Else
    Info = Info & "," & i.Offset(, 12).Value
    End If
    End If
    Next i
    Range("K" & j) = Info
    Next j


    is returning what I want but some of the values return with too many "," some of them with more than 10. For example: Car,,,,,,,,,,,,,,,Lot,Men,,,,,,,,

  2. #2
    Registered User
    Join Date
    08-09-2006
    Posts
    30
    I believe its because you declare info = "" too early. You later reset info to something else. However, for each iteration of the for loop you don't reset info back to "". At the very end of the for loop try putting another info ="", so the next time through will start clean.

+ Reply to Thread

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