title: How do I conditionally copy selected cells from a row and format the paste?
body: <p>I'm trying to create an offer generator that use data from multiple product tables that the user manipulates. My quest for user friendliness has created some problems for me however and I'm turning to you for help.</p>
  
  <p>To easier understand what I'm trying to achieve I'm attaching a picture showing what I have to work with. I will have multiple tables like the two shown in this picture and all the data shown is fictive. The tables will also have different amount of price groups.</p>
  
  <p><img src="https://i.stack.imgur.com/uhbcI.png" alt="enter image description here"></p>
  
  <p>What I want to do is have a button with an attached macro that look through the M (sold) column. If it finds a number larger than 0, it copies the sold amount and put it in the B column, create a string and place it in the C column containing Product Name and Description that is tied to the table and finally binding time. If the binding time is empty "no binding" should be returned. Lastly the J (monthly fee) column should be copied to the E column.</p>
  
  <p>The macro/function should keep adding entries like this for all rows that has a Sold value greater than 0. To finish it off a border and sum is to be made at the end.</p>
  
  <p>I'm at my wits end right now, is this doable or have I painted myself into a corner?</p>
  
  <p>Edit 1:</p>
  
  <p>Thanks to the help of @rgo I'm well on my way to get this working! I fiddled around a bit with placement of my cells and for the sake of understanding my code below, the generated table spans B:E on row 3, with the headers 'Amount', 'Description', 'Monthly Fee', 'Total' (amount * monthly fee).</p>
  
  <p>The table data looks the same over G:N, M is populated by + - buttons to increase/decrease the value in N. O and P columns contains hidden text strings with product name and additional description.</p>
  
  <p>Edit 2:
  I finally got the macro to do what I want! There might be room for improvements, and I'm happy to listen to suggestion, but the following code does the job:</p>
  
  <pre><code>    Dim sWS As Worksheet
  Dim aCell As Range
  Dim lRow As Long
  lRow = 3
  Set sWS = ThisWorkbook.Sheets("Sheetname")
  
  Range("B3:E40").clear 'clear the cell range before re-running the macro'
  
  For Each aCell In sWS.Range("N3:N100")
      'check if the encountered value in the N column is a number greater than 0. If it is fill B:E columns with the desired data'
      If IsNumeric(aCell.Value) = True And aCell.Value &gt; 0 Then
          sWS.Range("B" &amp; lRow) = sWS.Range("N" &amp; aCell.Row)
          sWS.Range("D" &amp; lRow) = sWS.Range("I" &amp; aCell.Row)
          sWS.Range("E" &amp; lRow) = "=B" &amp; lRow &amp; "*D" &amp; lRow
          sWS.Range("C" &amp; lRow) = sWS.Range("P" &amp; aCell.Row) &amp; " " &amp; sWS.Range("Q" &amp; aCell.Row) &amp; " " &amp; sWS.Range("M" &amp; aCell.Row)
  
  
          lRow = lRow + 1
      End If
  Next aCell
  
  lRow = lRow + 1
  
  'draw border and add formula to sum the E column'
  
  Range("B" &amp; lRow, "E" &amp; lRow).Select
  Selection.Borders(xlDiagonalDown).LineStyle = xlNone
  Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  Selection.Borders(xlEdgeLeft).LineStyle = xlNone
  With Selection.Borders(xlEdgeTop)
      .LineStyle = xlContinuous
      .ColorIndex = 0
      .TintAndShade = 0
      .Weight = xlThick
  End With
  Selection.Borders(xlEdgeBottom).LineStyle = xlNone
  Selection.Borders(xlEdgeRight).LineStyle = xlNone
  Selection.Borders(xlInsideVertical).LineStyle = xlNone
  Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  
  sWS.Range("C" &amp; lRow) = "Total monthly costs"
  sWS.Range("E" &amp; lRow).Formula = "=Sum(E2:E" &amp; lRow - 1 &amp; ")"
  </code></pre>