Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Append Excel Data from a named Range to an Exceldatabase

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Append Excel Data from a named Range to an Exceldatabase

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Append Excel Data from a named Range to an Exceldatabase

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Append Excel Data from a named Range to an Exceldatabase

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
office 07: auto powerpoint charts using named range data in excel robert2b Charts and Charting in Excel 0 November 28th 07 11:15 PM
Named Range DTS Import of Excel Data Harold I Excel Discussion (Misc queries) 0 September 28th 07 05:38 PM
Outlook wants an Excel named range to import contact data why? GDB026 Excel Discussion (Misc queries) 1 December 16th 05 04:59 PM
New Named Range Created Each Time Data Imported into Excel via Macro Carroll Rinehart Excel Programming 2 October 28th 04 04:33 PM
Append new row of data to range Art[_5_] Excel Programming 4 October 26th 03 01:14 PM


All times are GMT +1. The time now is 05:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"