adding rows, pasting values then empty sheet
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? |
adding rows, pasting values then empty sheet
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 "misscharliebrown" wrote: 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? |
adding rows, pasting values then empty sheet
thank you so much.. that was some sweet code
"Sheeloo" wrote: 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 "misscharliebrown" wrote: 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? |
All times are GMT +1. The time now is 06:04 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com