#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default exporting

Hello,

I have a spreadsheet that I need to export selected data to a file. It
can be a spreadsheet. My file is over 1mb and I just need to export the
actual values of a particular range to a backup file. Any ideas?

Ernst.



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default exporting

Dim sh as Worksheet
Dim rng as Range
Dim varr as Variant
On Error Resume Next
Kill "C:\Backup\MyData.xls"
On Error goto 0
ActiveWorkbook.SaveCopyAs Filename:="C:\Backup\Mydata.xls"
workbooks.Open "C:\Backup\MyData.xls"
for each sh in ActiveWorkbook.Worksheets
if sh.Name < "Data" then
application.DisplayAlerts = False
sh.Delete
Application.DisplayAlerts = True
end if
Next
with worksheets("Data")
set rng = .Range("A1").CurrentRegion
vArr = rng.value
.Usedrange.Clearcontents
rng.Value = varr
End With
Activeworkbook.Close Savechanges:=True

--
Regards,
Tom Ogilvy

"Ernst Guckel" wrote in message
...
Hello,

I have a spreadsheet that I need to export selected data to a file. It
can be a spreadsheet. My file is over 1mb and I just need to export the
actual values of a particular range to a backup file. Any ideas?

Ernst.





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default exporting

Dim sh as Worksheet
Dim rng as Range
Dim varr as Variant
On Error Resume Next
Kill "C:\Backup\MyData.xls"
On Error goto 0
ActiveWorkbook.SaveCopyAs Filename:="C:\Backup\Mydata.xls"
workbooks.Open "C:\Backup\MyData.xls"
for each sh in ActiveWorkbook.Worksheets
if sh.Name < "Data" then
application.DisplayAlerts = False
sh.Delete
Application.DisplayAlerts = True
end if
Next


This works great.

with worksheets("Data")
set rng = .Range("A1").CurrentRegion
vArr = rng.value
.Usedrange.Clearcontents
rng.Value = varr
End With
Activeworkbook.Close Savechanges:=True


but I don't understand what the last bit of code is to accomplish...

Ernst.


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
exporting hotdog Excel Discussion (Misc queries) 0 April 26th 08 02:36 AM
Exporting Dave2 Excel Discussion (Misc queries) 0 December 10th 07 02:26 AM
Exporting Mac Kearney Excel Discussion (Misc queries) 1 June 13th 06 07:55 PM
exporting njanja Excel Discussion (Misc queries) 4 April 12th 06 12:23 AM
exporting to CSV Marc Excel Worksheet Functions 2 December 6th 04 11:02 PM


All times are GMT +1. The time now is 09:20 AM.

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"