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

I'm addressing the age-old question of exporting data from Excel to
(fill in the blank).

I need speed (dealing with a large amount of data many times over)

The goal of the Excel spreadsheet I've written is to take a range and
save it in a file (.txt, .csv, .whatever) so that it can be read in
later by another Excel spreadsheet.

What I know so far is that if I (programatically via VBA) cut the
range, open a new workbook, paste the values and save the workbook,
this seems ? to be the fastest. However, I'm told this is not best
practices.

I've also tried looping through the range and assigning the values to
an array then write the array out. Takes too long.

Does anyone know the most efficient way to capture a range and save it
to a file?

All ideas are welcome. Thanks a ton.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 227
Default Fast Export

Hi Kelly

I'm sure there are faster ways, but....

Sub Test2()
Dim wb As Workbook, wb1 As Workbook
Dim ws As Worksheet, ws1 As Worksheet, r As Range

Application.ScreenUpdating = False
Application.Calculation = xlManual
Application.EnableEvents = False
Application.DisplayAlerts = False

Set wb = ThisWorkbook
Set ws = wb.Sheets("Sheet1")
Set r = ws.Range("A2:Z50000")

Workbooks.Add -4167
Set wb1 = ActiveWorkbook
Set ws1 = wb1.ActiveSheet
ws1.Range("A2:Z50000").Formula = r.Value
wb1.SaveAs Filename:=ThisWorkbook.Path & "\MyFile.csv"
wb1.Close

Application.ScreenUpdating = True
Application.Calculation = xlAutomatic
Application.EnableEvents = True
Application.DisplayAlerts = True
End Sub


--
XL2002
Regards

William


"Kelly" wrote in message
om...
| I'm addressing the age-old question of exporting data from Excel to
| (fill in the blank).
|
| I need speed (dealing with a large amount of data many times over)
|
| The goal of the Excel spreadsheet I've written is to take a range and
| save it in a file (.txt, .csv, .whatever) so that it can be read in
| later by another Excel spreadsheet.
|
| What I know so far is that if I (programatically via VBA) cut the
| range, open a new workbook, paste the values and save the workbook,
| this seems ? to be the fastest. However, I'm told this is not best
| practices.
|
| I've also tried looping through the range and assigning the values to
| an array then write the array out. Takes too long.
|
| Does anyone know the most efficient way to capture a range and save it
| to a file?
|
| All ideas are welcome. Thanks a ton.


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


William,

I'm exploring this code. I am unfamiliar with the -4167 parameter on the
end of the Workbooks.Add. What is that doing and what are some other
options?

Thanks.


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
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
You Need Fast Money ????? You Need Fast Money??? Excel Worksheet Functions 0 December 16th 08 11:37 PM
export re-order input fields to export file [csv] madisonpete Excel Worksheet Functions 0 November 30th 07 03:51 PM
need formula help fast please!! Meenie Excel Discussion (Misc queries) 4 July 26th 07 04:39 PM
Need help fast! [email protected] Excel Discussion (Misc queries) 2 October 1st 05 04:10 AM
Need help fast! Thanks! spectator Excel Discussion (Misc queries) 4 July 27th 05 07:01 AM


All times are GMT +1. The time now is 04:11 PM.

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

About Us

"It's about Microsoft Excel"