Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 112
Default How can I Write this to a CSV File Please

Hi Everyone,

How can I get the Results of the Below Program to Write to a CSV File
Please.
I would like the File to be Written to C:\Documents and Settings\Paul\My
Documents\Personal with the File Name Combinations.
Am I Right in Saying that it is Much Quicker to Write to a CSV ( or Text
) File than Write Directly to an Excel Spreadsheet. Is it a Simple Task
then to Load this into an Excel Spreadsheet.

Here is the Code :-

Option Explicit
Option Base 1

Public A As Integer
Public B As Integer
Public C As Integer
Public D As Integer
Public E As Integer
Public F As Integer

Sub Combinations()
Application.ScreenUpdating = False
Sheets("Combinations").Select
Range("A1").Select
Columns("A:IV").ColumnWidth = 18
Columns("A:IV").HorizontalAlignment = xlCenter

For A = 1 To 10
For B = A + 1 To 11
For C = B + 1 To 12
For D = C + 1 To 13
For E = D + 1 To 14
For F = E + 1 To 15

ActiveCell.Value = Application.WorksheetFunction.Text(A, "00") & "-" _
& Application.WorksheetFunction.Text(B, "00") & "-" _
& Application.WorksheetFunction.Text(C, "00") & "-" _
& Application.WorksheetFunction.Text(D, "00") & "-" _
& Application.WorksheetFunction.Text(E, "00") & "-" _
& Application.WorksheetFunction.Text(F, "00")
ActiveCell.Offset(1, 0).Select

Next F
Next E
Next D
Next C
Next B
Next A

Application.ScreenUpdating = True
End Sub

Thanks in Advance.
All the Best.
Paul




*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default How can I Write this to a CSV File Please


Hi Paul.

I sent a mail yesterday 14:19 GMT.
to 'paul_black27' on hotmail related to a previous thread.

i've spent a 'few' hours on it, and it includes some truely nifty
combination coding... including some write routines for csv.
(even a "shaped" csv that wraps at 65536 lines)

no reaction at all. which I did find a bit surprising.
.. did you not get/read that mail?


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Paul Black wrote :

Hi Everyone,

How can I get the Results of the Below Program to Write to a CSV File
Please.
I would like the File to be Written to C:\Documents and
Settings\Paul\My Documents\Personal with the File Name Combinations.
Am I Right in Saying that it is Much Quicker to Write to a CSV ( or
Text ) File than Write Directly to an Excel Spreadsheet. Is it a
Simple Task then to Load this into an Excel Spreadsheet.

Here is the Code :-

Option Explicit
Option Base 1

Public A As Integer
Public B As Integer
Public C As Integer
Public D As Integer
Public E As Integer
Public F As Integer

Sub Combinations()
Application.ScreenUpdating = False
Sheets("Combinations").Select
Range("A1").Select
Columns("A:IV").ColumnWidth = 18
Columns("A:IV").HorizontalAlignment = xlCenter

For A = 1 To 10
For B = A + 1 To 11
For C = B + 1 To 12
For D = C + 1 To 13
For E = D + 1 To 14
For F = E + 1 To 15

ActiveCell.Value = Application.WorksheetFunction.Text(A, "00") & "-" _
& Application.WorksheetFunction.Text(B, "00") & "-" _
& Application.WorksheetFunction.Text(C, "00") & "-" _
& Application.WorksheetFunction.Text(D, "00") & "-" _
& Application.WorksheetFunction.Text(E, "00") & "-" _
& Application.WorksheetFunction.Text(F, "00")
ActiveCell.Offset(1, 0).Select

Next F
Next E
Next D
Next C
Next B
Next A

Application.ScreenUpdating = True
End Sub

Thanks in Advance.
All the Best.
Paul




*** Sent via Developersdex http://www.developersdex.com ***

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 394
Default How can I Write this to a CSV File Please

Appologies keepITcool,

My Filters are Set to Exclusive and to Delete Junk email Immediately.
I have Reset the Filter so I should be Able to Receive it if you can
Send it to me Again Please.
Thanks for All your Time and Effort on this, it is Appreciated.

All the Best.
Paul



keepITcool wrote:
Hi Paul.

I sent a mail yesterday 14:19 GMT.
to 'paul_black27' on hotmail related to a previous thread.

i've spent a 'few' hours on it, and it includes some truely nifty
combination coding... including some write routines for csv.
(even a "shaped" csv that wraps at 65536 lines)

no reaction at all. which I did find a bit surprising.
. did you not get/read that mail?


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Paul Black wrote :

Hi Everyone,

How can I get the Results of the Below Program to Write to a CSV File
Please.
I would like the File to be Written to C:\Documents and
Settings\Paul\My Documents\Personal with the File Name Combinations.
Am I Right in Saying that it is Much Quicker to Write to a CSV ( or
Text ) File than Write Directly to an Excel Spreadsheet. Is it a
Simple Task then to Load this into an Excel Spreadsheet.

Here is the Code :-

Option Explicit
Option Base 1

Public A As Integer
Public B As Integer
Public C As Integer
Public D As Integer
Public E As Integer
Public F As Integer

Sub Combinations()
Application.ScreenUpdating = False
Sheets("Combinations").Select
Range("A1").Select
Columns("A:IV").ColumnWidth = 18
Columns("A:IV").HorizontalAlignment = xlCenter

For A = 1 To 10
For B = A + 1 To 11
For C = B + 1 To 12
For D = C + 1 To 13
For E = D + 1 To 14
For F = E + 1 To 15

ActiveCell.Value = Application.WorksheetFunction.Text(A, "00") & "-" _
& Application.WorksheetFunction.Text(B, "00") & "-" _
& Application.WorksheetFunction.Text(C, "00") & "-" _
& Application.WorksheetFunction.Text(D, "00") & "-" _
& Application.WorksheetFunction.Text(E, "00") & "-" _
& Application.WorksheetFunction.Text(F, "00")
ActiveCell.Offset(1, 0).Select

Next F
Next E
Next D
Next C
Next B
Next A

Application.ScreenUpdating = True
End Sub

Thanks in Advance.
All the Best.
Paul




*** Sent via Developersdex http://www.developersdex.com ***


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default How can I Write this to a CSV File Please

done.

pls give me a different email account for follow up..
( i think there will be some :)

my email is in sig below. just add @ and .

i find this combination stuff amusing
AND good training on writing efficient VBA code. (memory/speed etc)

my code now generates a byte array
for combin(49/5) = 1.9 mio = 4 secs
for combin(49/6) = 13.9 mio = 35 secs

timings on 1.4 Mhz (M/celeron) laptop/512Mb mem.

persisting to CSV takes a minute or so.
persisting to Worksheet dies.

--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Paul Black wrote :

Appologies keepITcool,

My Filters are Set to Exclusive and to Delete Junk email Immediately.
I have Reset the Filter so I should be Able to Receive it if you can
Send it to me Again Please.
Thanks for All your Time and Effort on this, it is Appreciated.

All the Best.
Paul



keepITcool wrote:
Hi Paul.

I sent a mail yesterday 14:19 GMT.
to 'paul_black27' on hotmail related to a previous thread.

i've spent a 'few' hours on it, and it includes some truely nifty
combination coding... including some write routines for csv.
(even a "shaped" csv that wraps at 65536 lines)

no reaction at all. which I did find a bit surprising.
. did you not get/read that mail?


--
keepITcool
www.XLsupport.com | keepITcool chello nl | amsterdam



Paul Black wrote :

Hi Everyone,

How can I get the Results of the Below Program to Write to a CSV
File Please.
I would like the File to be Written to C:\Documents and
Settings\Paul\My Documents\Personal with the File Name
Combinations. Am I Right in Saying that it is Much Quicker to
Write to a CSV ( or Text ) File than Write Directly to an Excel
Spreadsheet. Is it a Simple Task then to Load this into an Excel
Spreadsheet.

Here is the Code :-

Option Explicit
Option Base 1

Public A As Integer
Public B As Integer
Public C As Integer
Public D As Integer
Public E As Integer
Public F As Integer

Sub Combinations()
Application.ScreenUpdating = False
Sheets("Combinations").Select
Range("A1").Select
Columns("A:IV").ColumnWidth = 18
Columns("A:IV").HorizontalAlignment = xlCenter

For A = 1 To 10
For B = A + 1 To 11
For C = B + 1 To 12
For D = C + 1 To 13
For E = D + 1 To 14
For F = E + 1 To 15

ActiveCell.Value = Application.WorksheetFunction.Text(A, "00") &
"-" _ & Application.WorksheetFunction.Text(B, "00") & "-" _
& Application.WorksheetFunction.Text(C, "00") & "-" _
& Application.WorksheetFunction.Text(D, "00") & "-" _
& Application.WorksheetFunction.Text(E, "00") & "-" _
& Application.WorksheetFunction.Text(F, "00")
ActiveCell.Offset(1, 0).Select

Next F
Next E
Next D
Next C
Next B
Next A

Application.ScreenUpdating = True
End Sub

Thanks in Advance.
All the Best.
Paul




*** Sent via Developersdex http://www.developersdex.com ***

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 394
Default How can I Write this to a CSV File Please

Hi keepITcool,

I have Just Received the File and Downloaded it.
Thank you VERY Much. I will Print Out the Subs etc Later and Try to get
my Head Round what is Happening and Why. As I said, I am New to VBA so
it will Probably take me a While to Understand the Programming and
Logic.
Thank you Again for ALL the Time and Effort in Regard to this, it is
MOST Appreciated.

All the Best.
Paul



Paul Black wrote:
Appologies keepITcool,

My Filters are Set to Exclusive and to Delete Junk email Immediately.
I have Reset the Filter so I should be Able to Receive it if you can
Send it to me Again Please.
Thanks for All your Time and Effort on this, it is Appreciated.

All the Best.
Paul



keepITcool wrote:
Hi Paul.

I sent a mail yesterday 14:19 GMT.
to 'paul_black27' on hotmail related to a previous thread.

i've spent a 'few' hours on it, and it includes some truely nifty
combination coding... including some write routines for csv.
(even a "shaped" csv that wraps at 65536 lines)

no reaction at all. which I did find a bit surprising.
. did you not get/read that mail?


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Paul Black wrote :

Hi Everyone,

How can I get the Results of the Below Program to Write to a CSV File
Please.
I would like the File to be Written to C:\Documents and
Settings\Paul\My Documents\Personal with the File Name Combinations.
Am I Right in Saying that it is Much Quicker to Write to a CSV ( or
Text ) File than Write Directly to an Excel Spreadsheet. Is it a
Simple Task then to Load this into an Excel Spreadsheet.

Here is the Code :-

Option Explicit
Option Base 1

Public A As Integer
Public B As Integer
Public C As Integer
Public D As Integer
Public E As Integer
Public F As Integer

Sub Combinations()
Application.ScreenUpdating = False
Sheets("Combinations").Select
Range("A1").Select
Columns("A:IV").ColumnWidth = 18
Columns("A:IV").HorizontalAlignment = xlCenter

For A = 1 To 10
For B = A + 1 To 11
For C = B + 1 To 12
For D = C + 1 To 13
For E = D + 1 To 14
For F = E + 1 To 15

ActiveCell.Value = Application.WorksheetFunction.Text(A, "00") & "-" _
& Application.WorksheetFunction.Text(B, "00") & "-" _
& Application.WorksheetFunction.Text(C, "00") & "-" _
& Application.WorksheetFunction.Text(D, "00") & "-" _
& Application.WorksheetFunction.Text(E, "00") & "-" _
& Application.WorksheetFunction.Text(F, "00")
ActiveCell.Offset(1, 0).Select

Next F
Next E
Next D
Next C
Next B
Next A

Application.ScreenUpdating = True
End Sub

Thanks in Advance.
All the Best.
Paul




*** Sent via Developersdex http://www.developersdex.com ***


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
Why can't I write out an Excel file? greaseman Excel Discussion (Misc queries) 3 April 24th 06 06:21 PM
read only file-need to write judithbear Excel Discussion (Misc queries) 4 January 17th 06 03:31 PM
Can I write each row to a separate file? BigIan Excel Worksheet Functions 0 November 10th 05 03:30 PM
Write Text File Nigel Excel Programming 9 March 31st 05 05:44 PM
write to external file mgasparel[_3_] Excel Programming 2 February 21st 05 05:02 PM


All times are GMT +1. The time now is 08:19 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"