macro

B

Baskaran

pls let me know how to collect details from the spreadsheet and placing in
text file using macros.
 
G

Gord Dibben

This is what you get when you use the macro recorder with your source workbook
open.

Sub Macro6()
Range("A1:F34").Select 'collect the details
Selection.Copy
'open a new workbook
Workbooks.Add Template:="Workbook"
Range("A1").Select
ActiveSheet.Paste 'paste the copied details to new book
Range("A1").Select
Application.CutCopyMode = False
'now save the new book as s *.txt file
ActiveWorkbook.SaveAs Filename:= _
"C:\Program Files\Microsoft Office\exceldata\Book1.txt", _
FileFormat:=xlText, _
CreateBackup:=False
ActiveWorkbook.Save
ActiveWindow.Close
End Sub


Gord Dibben MS Excel MVP
 
Top