View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] davcald@gmail.com is offline
external usenet poster
 
Posts: 1
Default Save range to text file.

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