![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Posts: 91
|
I am trying to use the below code to apend to a filebut it wont work and erros out at the Activesheet part every time dont understand why?
Use a named cell reference in to indicate the end of your sheet. Use that reference in the Macro, then offset and insert the copied cells. do it so the named reference gets pushed to the bottom every time. This sort of works (below) I didn't have time to get it to work properly. It opens a file copies a range closes the book then opens the destination book selects the named reference and pastes (thats the part you'll have to play around with) Workbooks.Open Filename:="C:\My Documents\KN\ROW COUNT.XLS" Range("A1651:A1665").Select Selection.Copy ActiveWindow.Close Workbooks.Open Filename:="C:\My Documents\KN\copypastetobottom.xls" Range("blankline").Select ''ActiveCell.Offset(-1, 0).Range _("blankline").Select Selection.EntireRow.Insert ActiveSheet.Paste ----error occurs --- Selection.Insert Shift:=xlDown |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Columbus, OH, USA
Posts: 3,519
|
My quick suggestion would be not to use this line of code:
This shuts down your first workbook. If need be use this line of code at the end of your macro:
I stress, put this line at the end of your macro. (or at least after you've "pasted") HTH |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|