Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy last row with data to next empty row...
Hi, I'm really stuck!!!! I've come across Ron de Bruin's website, which provides some great solutions for copying to other workbooks. Here's where I'm stuck. I would like to set my sourcerange to the last row that holds data and copy that row to another workbook on the next empty row of sheet1. I'm so close I can taste it !...I think When I run the macro, I'm getting Here's what I've got so far. Sub CopytoSP_history() Dim sourceRange As Range Dim destrange As Range Dim destWB As Workbook Dim Lr As Long Dim Lr1 As Long Application.ScreenUpdating = False If bIsBookOpen("SPHistory.xls") Then Set destWB = Workbooks("SPHistory.xls") Else Set destWB = Workbooks.Open("C:\EVENT TRACKER\TrackerLog\METRO\SPhistory\SPHistory.xls") End If Lr = Sheets("sheet1").Range("B" & Rows.Count).End(xlUp).Offset(1, 0).Row Lr1 = Sheets("METRO").Range("B" & Rows.Count).End(xlUp).Offset(0, 0).Row Set sourceRange = ThisWorkbook.Worksheets("SP").Range("B" & Lr1) Set destrange = destWB.Worksheets("Sheet1").Range("B" & Lr) sourceRange.Copy destrange.PasteSpecial xlPasteValues, , False, False Application.CutCopyMode = False destWB.Close True Application.ScreenUpdating = True End Sub Thanks, Oreg -- Oreg ------------------------------------------------------------------------ Oreg's Profile: http://www.excelforum.com/member.php...fo&userid=9195 View this thread: http://www.excelforum.com/showthread...hreadid=480972 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
formula to copy data to empty cell | New Users to Excel | |||
Clipboard empty but get cannot empty CB when trying to copy | Excel Worksheet Functions | |||
How to copy data to the next empty cell in a column | Excel Worksheet Functions | |||
Copy Data From Filled to Empty Cells | Excel Discussion (Misc queries) | |||
macro to copy paste non empty data | Excel Programming |