Save range to text file.

D

davcald

I need to create a text file, containing a range of cells in a
worksheet. I recorded the following macro to selct the range, paste
special as text into a seperate worksheet, and save the worksheet
containing the text to a text file. This works, but also saves the
entire workbook as a new workbook in text format. I would like find a
way to export the range directly into a text file, or be able to save
the worksheet caontaing the text without saveing teh entire workbook
as text. I have seen some example here, but they are somewhat
complicated, and I can not get them to out put the range I need
(G15:J25). Can someone suggest a modification to output the range to a
text file without saving the workbook as a text file.

Thanks


Sub Macro1()
'
' Macro1 Macro
'

'
Range("G15:J25").Select
Selection.Copy
Sheets("lookuptable").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ChDir "C:\Users\David\Desktop"
ActiveWorkbook.SaveAs Filename:= _
"C:\Users\David\Desktop\lookuptable.txt", FileFormat _
:=xlText, CreateBackup:=False
Sheets("calibration").Select
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top