title: An Excel macro that can add and populate a new row to a separate worksheet using data from two columns
body: <p>What I am trying to do is this.</p>
  
  <p>I have a customer information form, with information stored on the 1st sheet in two columns, the range is F5:F38,M5:M33</p>
  
  <p>I have an empty database on worksheet2 that i'd like to populate with this data, Starting on C5 across to BM5</p>
  
  <p>I want to be able to assign the macro to an 'add' button, and have the macro automatically insert a new row for the data and copy it across, enabling users to use worksheet1 to populate!</p>
  
  <p>Matt</p>
  
  <p>Updated from David's advice thus far. The only outstanding issue is that when running the script, Column M has the marching ants but the data itself does not copy across. For further clarity, the sheet has data validation and some conditional formatting (a few drop-down options and some colour coding on Y/N answers), i'm not sure if this is a factor.</p>
  
  <pre><code>Dim wsDB As Worksheet
  Dim wsInfo As Worksheet
  
  Sub Main()
  Set wsDB = Worksheets("DATABASE")
  Set wsInfo = Worksheets("INPUT")
  
  insertnewrow
  addcolumnf
  addcolumnm
  
  End Sub
  Sub insertnewrow()
  '
  ' insertnewrow Macro
  
      wsDB.Rows("6:6").Insert _
          Shift:=xlDown, _
          CopyOrigin:=xlFormatFromLeftOrAbove
  End Sub
  Sub addcolumnf()
  '
  ' addcolumnf Macro
  
      wsInfo.Range("F5:F38").Copy
      wsDB.Range("C6:AJ6").PasteSpecial _
              Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
              False, Transpose:=True
  
  
  End Sub
  Sub addcolumnm()
  '
  ' addcolumnm Macro
  '
      Application.CutCopyMode = False
      wsInfo.Range("M5:M33").Copy
      wsDB.Range("AK6:BM6").PasteSpecial _
              Paste:=xlAllExceptBorders, Operation:=xlNone, _
              SkipBlanks:=False, Transpose:=True
  
  End Sub
  </code></pre>