I am populating a table in Excel with data from other worksheets. The table has four rows. when the rows are filled it should delete the first row moving everything up one row and adding the new data to the last row. Here's the code I have to do this, but it isn't working.
NextRow = ThisWorkbook.Worksheets("Average Trend").Range("A16").End(xlUp).Row + 1
MsgBox NextRow
If NextRow = 16 Then
Range("A13").Select
Selection.EntireRow.Insert
Range("A14:J16").Select
Selection.Copy
Range("A12").Select
ActiveSheet.Paste
Range("A16").Select
Selection.EntireRow.Delete
Range("A15:J15").Select
Selection.ClearContents
Range("A16").Select
'Update NextRow value
NextRow = ThisWorkbook.Worksheets("Average Trend").Range("A16").End(xlUp).Row + 1
MsgBox NextRow
Else
End If
Maybe this isn't the best way to do this. I'm not sure. Any help is appreciated. Thanks!
NextRow = ThisWorkbook.Worksheets("Average Trend").Range("A16").End(xlUp).Row + 1
MsgBox NextRow
If NextRow = 16 Then
Range("A13").Select
Selection.EntireRow.Insert
Range("A14:J16").Select
Selection.Copy
Range("A12").Select
ActiveSheet.Paste
Range("A16").Select
Selection.EntireRow.Delete
Range("A15:J15").Select
Selection.ClearContents
Range("A16").Select
'Update NextRow value
NextRow = ThisWorkbook.Worksheets("Average Trend").Range("A16").End(xlUp).Row + 1
MsgBox NextRow
Else
End If
Maybe this isn't the best way to do this. I'm not sure. Any help is appreciated. Thanks!