-
Just a side note:
[vba]
msgbox format(9,"000")
msgbox format(56,"000")
msgbox format(348,"000")
[/vba]
VBA has a method to append data to a file; if the file doesn't exist it will be created, if it exists data will be added to the existing data in the file
[vba]Sub snb()
Application.DisplayAlerts = False
Sheets(1).Copy
With ActiveWorkbook.Sheets(1)
.Rows(1371).Resize(Rows.Count - 1370).Delete
.Columns(641).Resize(.Columns.Count - 640).Delete
.SaveAs "G:\OF\new.txt", xlTextMSDOS
.Parent.Close False
End With
Open "D:\xx\yy\Coarse grids\MS_EC_" & Format(kk, "000") & "Coarse.txt" For Append As #1
Print #1, CreateObject("scripting.filesystemobject").opentextfile("G:\OF\new.csv").re adall
Close
End Sub[/vba]
Last edited by snb; 09-30-2012 at 02:43 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules