title: EXCEL VBA - Loop through cells in a column, if not empty, print cell value into another column
body: <p>I'm very new to Excel VBA and haven't quite familiarized myself with all the different functions and such, and I'm quite sure I understand how to use IF statements within FOR loops, so I'm not quite sure how to go about creating the code.</p>
  
  <p>This is what I would like to have happen:</p>
  
  <pre><code>A1 Food       B1 Selected?   D1 Selections
  A2 Grapes     B2 Yes         D2 Grapes
  A3 Tomato     B3             D3 Mango
  A4 Mango      B4 Yes         D4 Spinach
  A5 Spinach    B5 Yes     
  A6 Carrots    B6
  A7 Onion      B7 
  </code></pre>
  
  <p>My thought process:</p>
  
  <p>1) Create a FOR loop in range of B2 to B7 to check for the value 'YES'<br />
  2) If the value is yes, the corresponding value in the adjacent cell in A should be printed into D.<br />
  3) Else, it should continue looping through the cells.<br /></p>
  
  <p>I imagine that VLOOKUP is also involved somewhere within the if statement, and variables need to be defined to establish the range?</p>
  
  <p>Would appreciate any help.</p>
  
  <p>Thanks!</p>