View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Paul Black[_2_] Paul Black[_2_] is offline
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 ***