View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
muddan madhu muddan madhu is offline
external usenet poster
 
Posts: 747
Default Copy selected columns from .xls to a .txt file question

try this

Sub Copy_Rows()

With Application
.DisplayAlerts = False
.ScreenUpdating = False
End With

FpatH = "C:\Documents and Settings\username\filename.xls"

Workbooks.Open FpatH
FileP = ActiveWorkbook.path
Range("B1:C100").Copy
Workbooks.Add
ActiveSheet.Paste

ActiveWorkbook.SaveAs Filename:= _
FileP & "\" & "1.txt", FileFormat:=xlUnicodeText,
CreateBackup:=False

ActiveWorkbook.Close True

With Application
.DisplayAlerts = True
.ScreenUpdating = True
.CutCopyMode = False
End With

End Sub




On Dec 3, 10:00*am, gedinfo wrote:
I would like to be able to copy two columns from a .xls file, columns 2
(B) and 9(I) into a .txt file for approximately 100 rows, using VBA.
What is the best way to do this?

Thank you