adding rows, pasting values then empty sheet

  • Thread starter Thread starter misscharliebrown
  • Start date Start date
M

misscharliebrown

Hi:
If I import a report weekly (and therefore though it has the same columns -
5, the row number varies) onto a worksheet "synergy". How can I move all this
to the worksheet "lifetime" (same workbook) at the next available row at the
bottom of the table located in "lifetime". With the values still intacted
(colums include date and numbers). then erase the synergy worksheet ready for
the nexts weeks update?
 
Try
'Replace Sheet1 by Synergy and Sheet2 by Lifetime everywhere...

Sub CopyRow()
Dim Answer As String
Dim LastRowOnSheet1, LastRowOnSheet2 As Long
With Worksheets("Sheet1")
LastRowOnSheet1 = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
If LastRowOnSheet1 = 1 Then MsgBox "Nothing to Copy"
With Worksheets("Sheet2")
LastRowOnSheet2 = .Cells(.Rows.Count, "A").End(xlUp).Row
If LastRowOnSheet2 = 1 And .Cells(1, "A").Value = "" Then
LastRowOnSheet2 = 0
End If
'Answer = InputBox("Find which number in Row H and copy it?")
Worksheets("Sheet1").UsedRange. _
Copy .Range("A" & (LastRowOnSheet2 + 1))
End With
Worksheets("Sheet1").UsedRange.ClearContents
End Sub
 
thank you so much.. that was some sweet code

Sheeloo said:
Try
'Replace Sheet1 by Synergy and Sheet2 by Lifetime everywhere...

Sub CopyRow()
Dim Answer As String
Dim LastRowOnSheet1, LastRowOnSheet2 As Long
With Worksheets("Sheet1")
LastRowOnSheet1 = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
If LastRowOnSheet1 = 1 Then MsgBox "Nothing to Copy"
With Worksheets("Sheet2")
LastRowOnSheet2 = .Cells(.Rows.Count, "A").End(xlUp).Row
If LastRowOnSheet2 = 1 And .Cells(1, "A").Value = "" Then
LastRowOnSheet2 = 0
End If
'Answer = InputBox("Find which number in Row H and copy it?")
Worksheets("Sheet1").UsedRange. _
Copy .Range("A" & (LastRowOnSheet2 + 1))
End With
Worksheets("Sheet1").UsedRange.ClearContents
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top