View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default How to simply export a single sheet to a new .csv file?

Option Explicit
Sub Testme()
worksheets("sheet2").copy
With ActiveSheet
.Parent.SaveAs Filename:="C:\test1", _
FileFormat:=xlCSV
.Parent.Close savechanges:=False
End With
End Sub


wrote:

Hi,

I'm sure my problem is not that difficult but it seems unique as my
searches haven't come up with anything similar. I have an excel file,
test1.xls and I want to take sheet2 specifically and export it into C:
and call the file that contains it test1.csv. In the module, I have
something like this:

Sub exportcsv()

Dim sheet2 As Worksheet

For sheet2 In ActiveWorkbook.Worksheets
sheet2.Copy
With ActiveSheet
.Parent.SaveAs Filename:="C:" & .test1, _
FileFormat:=xlCSV
.Parent.Close savechanges:=False
End With

Thanks for any suggestions...

End Sub


--

Dave Peterson