Copy & Paste macro


Posted by Mark T on January 21, 2002 4:29 PM

I have an estimating workbook as a template. Once the estimating input is done, I need for a macro (assigned to a button) to copy six (6) cells in a row, automatically open another (running totals) workbook, paste the data into the next available row, then save the running totals workbook. Any suggestions?



Posted by Barrie Davidson on January 21, 2002 5:54 PM

Mark, you could try something like this:

Sub PastetoRunningTotals()
Dim EstimateWorkbook As String
Dim RunningTotal As String

EstimateWorkbook = ActiveWorkbook.Name
Workbooks.Open FileName:="C:\RunningTotal.xls"
'Note, change the file name to the correct one
RunningTotal = ActiveWorkbook.Name
Windows(EstimateWorkbook).Activate
Range("A1:A6").Copy
'Note, change the range to the range you want
Windows(RunningTotal).Activate
Range("A1").End(xlDown).Offset(1, 0).Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveWindow.Close True

End Sub


Hope this helps,
BarrieBarrie Davidson