I have a problem with Excel. Ive made a button that copies pre-made information from row and adds it on first empty row at end of a table on another sheet. Problem is that when a row is removed or cleared the first empty row is actually row after the row where data was last time copied.
Like:
-table is empty
-add 2 new rows of data witht he button
-now last empty row is row number 3
-remove those added rows
-add data at first empty row using the button
-data is added on 3rd row leaving 2 empty rows above
Here is the code:
Private Sub CommandButton3_Click()
Sheets("valmiit").Select
ActiveSheet.Range("A1:J1").Copy
Sheets("työlista").Select
Dim LastRow As Long
LastRow = ActiveCell.SpecialCells(xlLastCell).Row + 1
Worksheets("työlista").Cells(LastRow, 1).EntireRow.Select
ActiveCell.Offset(0, -ActiveCell.Column + 1).Select
ActiveSheet.Paste
End Sub
Does anyone have some solution to this? Ive tried with removing entire row and clearing it from everything, but neither of those works.
Like:
-table is empty
-add 2 new rows of data witht he button
-now last empty row is row number 3
-remove those added rows
-add data at first empty row using the button
-data is added on 3rd row leaving 2 empty rows above
Here is the code:
Private Sub CommandButton3_Click()
Sheets("valmiit").Select
ActiveSheet.Range("A1:J1").Copy
Sheets("työlista").Select
Dim LastRow As Long
LastRow = ActiveCell.SpecialCells(xlLastCell).Row + 1
Worksheets("työlista").Cells(LastRow, 1).EntireRow.Select
ActiveCell.Offset(0, -ActiveCell.Column + 1).Select
ActiveSheet.Paste
End Sub
Does anyone have some solution to this? Ive tried with removing entire row and clearing it from everything, but neither of those works.