Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I wish to add a code to a workbook in order to append information of a
named range "data" to an external Excelfile, the path to file is in a cell of the same workbook named "location". The sheet in the external file is called "database". The data of the named range (7 columns x 7rows) is structured exactly as in the "database".The twist is it needs to append the data below existing data in that file. I figure there need to be some sort of a loop which counts the last row and data needs to be copied beneath that data in the closed file. Maybe some one can help me out there. Thanks in advance, Sven! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Aug 15, 7:30 am, "
wrote: I wish to add a code to a workbook in order to append information of a named range "data" to an external Excelfile, the path to file is in a cell of the same workbook named "location". The sheet in the external file is called "database". The data of the named range (7 columns x 7rows) is structured exactly as in the "database".The twist is it needs to append the data below existing data in that file. I figure there need to be some sort of a loop which counts the last row and data needs to be copied beneath that data in the closed file. Maybe some one can help me out there. Thanks in advance, Sven! Sub CopyDataRange() Dim rngCopy as Range Dim wbDest as Workbook set rngCopy = Range("Data") set wbDest = Workbooks.Open(Range("location") 'Assuming Data on Database Sheet starts from Column A wbDest.Sheets("Database").Range("A65536").offset(1 ,0).PasteSpecial xlPasteAll Application.CutCopyMode = False wbDest.Save msgbox "Completed" End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for the post.
The code is not working even after modification. The missing part, however, is the appending of the data in the "database" file after the last line of existing data.How can i count the rows of data? After that i assume that i will use the second coordinate of the offset formula to trigger the row for the paste. Please help again. Sven Excel_Expert wrote: On Aug 15, 7:30 am, " wrote: I wish to add a code to a workbook in order to append information of a named range "data" to an external Excelfile, the path to file is in a cell of the same workbook named "location". The sheet in the external file is called "database". The data of the named range (7 columns x 7rows) is structured exactly as in the "database".The twist is it needs to append the data below existing data in that file. I figure there need to be some sort of a loop which counts the last row and data needs to be copied beneath that data in the closed file. Maybe some one can help me out there. Thanks in advance, Sven! Sub CopyDataRange() Dim rngCopy as Range Dim wbDest as Workbook set rngCopy = Range("Data") set wbDest = Workbooks.Open(Range("location") 'Assuming Data on Database Sheet starts from Column A wbDest.Sheets("Database").Range("A65536").offset(1 ,0).PasteSpecial xlPasteAll Application.CutCopyMode = False wbDest.Save msgbox "Completed" End Sub |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
Can you tell me what line doesn't seem to be working? Is there an error you face? Oh... I now see the error. I think I didn't write this line of code rngCopy.Copy Just re-copy the code and try running it. Sub CopyDataRange() Dim rngCopy as Range Dim wbDest as Workbook set rngCopy = Range("Data") set wbDest = Workbooks.Open(Range("location") rngCopy.Copy 'Assuming Data on Database Sheet starts from Column A wbDest.Sheets("Database").Range("A65536").offset(1 ,0).PasteSpecial xlPasteAll Application.CutCopyMode = False wbDest.Save msgbox "Completed" End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
office 07: auto powerpoint charts using named range data in excel | Charts and Charting in Excel | |||
Named Range DTS Import of Excel Data | Excel Discussion (Misc queries) | |||
Outlook wants an Excel named range to import contact data why? | Excel Discussion (Misc queries) | |||
New Named Range Created Each Time Data Imported into Excel via Macro | Excel Programming | |||
Append new row of data to range | Excel Programming |