export data from active wooksheet

August 25, 2017 at 05:54:48
Specs: Windows 10
I have produced an excel workbook with single worksheet as a template for end user. The workbook will save and quit with filename created based on 3 cell values. Can I make this workbook template automatically exporting certain data to another workbook? Another things is, can the new exported data have automatically new row to insert the data into the workbook/worksheet destination? I have checked related excel forum and found the code must have a filename to export data and I stuck on it. Here the code that i have tried:

Sub ExportData()

Sheets("Master").Range("C95").Copy Destination:=Sheets("Summary").Range("B9")
Sheets("Master").Range("E97").Copy Destination:=Sheets("Summary").Range("C9")
Sheets("Master").Range("T9").Copy Destination:=Sheets("Summary").Range("D9")
Sheets("Master").Range("T11").Copy Destination:=Sheets("Summary").Range("E9")
Sheets("Master").Range("E15").Copy Destination:=Sheets("Summary").Range("F9")
End Sub

-----------(other code that i've tried)--------------------------------

Sub ExportData()
Dim x As Workbook
Dim s As Workbook

Set x = Workbooks.Open("Template")
Set s = Workbooks.Open("Summary Report")

s.Sheets("Summary").Range("C95").Value = x.Sheets("Master").Range("B9")
s.Sheets("Summary").Range("E97").Value = x.Sheets("Master").Range("C9")
s.Sheets("Summary").Range("T9").Value = x.Sheets("Master").Range("D9") 
s.Sheets("Summary").Range("T11").Value = x.Sheets("Master").Range("E9") 
s.Sheets("Summary").Range("E15").Value = x.Sheets("Master").Range("F9")
End Sub

Appreciate the help. Thank you.

message edited by eltigre

See More: export data from active wooksheet

Report •

September 11, 2017 at 07:07:06
You can easily export data to another workbook when you create one dynamically. The problem I have is I don't know what your data looks like, so cannot offer much help. Can you post the layout of your worksheet and tell us what data needs to be exported and what triggers the export?

Please click on the link below to understand how to present your data on this site.


message edited by AlwaysWillingToLearn

Report •
Related Solutions

Ask Question