title: VBA Count rows in Table
body: <p>I Have put together a macro to move data from a input area which takes water readings and then puts them into a table on another sheet. </p>
  
  <p>Sheets are "water - Input", "water - Data", table is "water"</p>
  
  <p>I have got the macro to add a new table row and then move the data into the new row. </p>
  
  <p>I have added some text that says Success!, however, I would like to add the row number so that people can look for the record. </p>
  
  <p>This is the first piece of VBA I have written so sorry if its a little rough.</p>
  
  <pre><code>Sub waterInput()
  Dim the_sheet As Worksheet
  Dim table_list_object As ListObject
  Dim table_object_row As ListRow
  Set the_sheet = Sheets("Water - Data")
  Set table_list_object = the_sheet.ListObjects("Water")
  
  'Add new row to table "Water - Data"
  Set table_object_row = table_list_object.ListRows.Add
  
  table_object_row.Range(1, 1).Value = ""
  
  'Select $$ from input "Site"
  Sheets("Water - Input").Range("C10").Copy
  
  ActiveSheet.Paste Destination:=Worksheets("Water - Data").Range("B" &amp; Rows.Count).End(xlUp).Offset(0)
  
  'Select $$ from input "Date"
  Sheets("Water - Input").Range("E10").Copy
  
  ActiveSheet.Paste Destination:=Worksheets("Water - Data").Range("C" &amp; Rows.Count).End(xlUp).Offset(0)
  
  'Select $$ from input "Meter Number"
  Sheets("Water - Input").Range("I10").Copy
  ActiveSheet.Paste Destination:=Worksheets("Water - Data").Range("F" &amp; Rows.Count).End(xlUp).Offset(0)
  
  
  'Select $$ from input "Reading"
  Sheets("Water - Input").Range("K10").Copy
  
  ActiveSheet.Paste Destination:=Worksheets("Water - Data").Range("G" &amp; Rows.Count).End(xlUp).Offset(0)
  
  'Clear selected copy
  Application.CutCopyMode = False
  
  Sheets("Water - Input").Range("I12").Value = "Success"
  Sheets("Water - Input").Range("I13").Value = "Added to line"
  
  'Count rows and return number
  
  
  'Clear selected Input fields
  Sheets("Water - Input").Range("C10,I10,E10,G10,I10,k10").ClearContents
  
  End Sub'
  </code></pre>
  
  <p>Many thanks</p>
  
  <p>Tom</p>