View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default How to output a textfile format in such design

Put your data in A1 thru A13 and then run:

Sub Macro1()
ChDir "C:\"
ActiveWorkbook.SaveAs Filename:="C:\Book1.txt", FileFormat:=xlText, _
CreateBackup:=False
End Sub

--
Gary''s Student - gsnu2007j


" wrote:

Hi all,

I'm new for doing Excel programming.
Can someone teach me how to output a text file which the output design
should be like this:

Fruit01072008
Apple
classA;5000
classB;6000
classC;7000
Orange
classA;1000
classB;3000
classC;5000
Strawberry
ClassA;850
ClassB;1000
classC;1299


In the Excel Sheet contain:

Column A Column B Column C Column D
Fruit Orange 1000 ClassA
Fruit Orange 3000 ClassB
Fruit Orange 5000 ClassC
Fruit Apple 5000 ClassA
Fruit Apple 6000 ClassB
Fruit Apple 7000 ClassC
Fruit Strawberry 850 ClassA
Fruit Strawberry 1000 ClassB
Fruit Strawberry 1299 ClassC