title: Loop to Find Dependencies
body: <p>I have data on a sheet named 'Dependencies' like you see in the image below.  The actual data is slightly different, but this example will illustrate the point.</p>
  
  <p><a href="https://i.stack.imgur.com/RUA6V.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RUA6V.png" alt="enter image description here"></a></p>
  
  <pre><code>Here is the data:
      Category Name   Dependencies
      Beverages   SoftDrinks
      Beverages   Coffees
      Beverages   Teas
      Beverages   Beers
      Beverages   Andales
      Condiments  Sweetandsavorysauces
      Condiments  Relishes
      Condiments  Spreads
      Condiments  Andseasonings
  </code></pre>
  
  <p>I have another sheet classically named 'Sheet1'.  It looks like this.</p>
  
  <p>[![enter image description here][2]][2]</p>
  
  <p>I am trying to figure out how to create a Macro to produce a final result like this.</p>
  
  <p>[![enter image description here][3]][3]</p>
  
  <p>So, basically, I need to check the value in Cell B2 in Sheet 1, find all matches in ColumnA of the Dependencies sheet, and concatenate all values in the adjacent cells, in ColumnB.  The results have to be concatenated together, with line-breaks between each value.  Also, I need to have the ID in Sheet1 appended into the final result.</p>
  
  <p>I tried a few things like Vlookups, and Index/Match, but couldn’t get anything working.  I’m sure it’s possible with VBA.  I just don’t know exactly how to do it.  I’m still testing some ideas.  I’ll post back with any updates that I have.  If someone can figure this out before I do, please share your answer.</p>
  
  <p>Thanks to all!</p>
  
  <p>I’m back in my office now and testing this on my actual data set.  <strong>There is a slight flaw in the logic so the row number is off.</strong>  I need to do some kind of lookup between Dependence and TaskTitle, and take the number of the TaskTitle.  Look at the image below.  </p>
  
  <p><a href="https://i.stack.imgur.com/RUA6V.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RUA6V.png" alt="enter image description here"></a></p>
  
  <p>So, this: 3. Complete Fair Lending Attestation SHOULD be this: 1. Complete Fair Lending Attestation.  Also, this 4. Update Fair Lending Tollgate Information SHOULD be this: 3. Update Fair Lending Tollgate Information.</p>
  
  <p>Does it make sense?</p>