Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have data in col a to e:
I would like a macro that would copy all the data(all the way to the bottom) and then save that data as a CSV file. I would appreciate any help I can get with this Thanks Ian M |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Ian,
Am Sun, 28 Apr 2013 06:43:21 -0700 (PDT) schrieb pcorcele: I have data in col a to e: I would like a macro that would copy all the data(all the way to the bottom) and then save that data as a CSV file. try: Sub SaveAsCSV() Dim WbkName As String Dim myPath As String WbkName = "Test" myPath = "C:\Users\Claus Busch\Desktop\" Sheets("Tabelle1").Copy ActiveWorkbook.SaveAs Filename:=myPath & WbkName & ".csv", _ FileFormat:=xlCSV, CreateBackup:=False ActiveWorkbook.Close End Sub Regards Claus Busch -- Win XP PRof SP2 / Vista Ultimate SP2 Office 2003 SP2 /2007 Ultimate SP2 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
pcorcele wrote:
I have data in col a to e: I would like a macro that would copy all the data(all the way to the bottom) and then save that data as a CSV file. I would appreciate any help I can get with this If you only have data in the range A:E, I'd say use Claus' solution. But if you have data outside those columns that you don't want exported, you might try this instead: Sub copyA_EtoCSV() fileout = FreeFile Open "data.csv" For Output As fileout For r = 1 To Range("A:E").SpecialCells(xlCellTypeLastCell).Row Write #fileout, Cells(r, 1).Value, Cells(r, 2).Value, _ Cells(r, 3).Value, Cells(r, 4).Value, Cells(r, 5).Value Next Close fileout End Sub (This will also work if there's only data in A:E like Claus' code, but this makes sure that anything beyond column E isn't exported, regardless.) In both Claus' code and mine above, the path for the CSV needs to be set appropriately. (Claus shows how to do it based on where the workbook is; I use a fixed location.) -- Sorry if I'm in this business to make the world a better place, not out of misplaced guilt. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Sunday, April 28, 2013 9:43:21 AM UTC-4, pcorcele wrote:
I have data in col a to e: I would like a macro that would copy all the data(all the way to the bottom) and then save that data as a CSV file. I would appreciate any help I can get with this Thanks Ian M Thanks for all the help.I did try your suggestions......But I found out that I did not give you all the info required. Using your suggestions, copied the ENTURE file. My file consists of THREE sheets. I just want to copy the first sheet which is called MYMOVIES. I would appreciate any help with this and thanks Ian M |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Ian,
Am Mon, 29 Apr 2013 06:52:43 -0700 (PDT) schrieb pcorcele: Thanks for all the help.I did try your suggestions......But I found out that I did not give you all the info required. Using your suggestions, copied the ENTURE file. My file consists of THREE sheets. I just want to copy the first sheet which is called MYMOVIES. I would appreciate any help with this and thanks change the line with copy to: Sheets("MYMOVIES").Copy Regards Claus Busch -- Win XP PRof SP2 / Vista Ultimate SP2 Office 2003 SP2 /2007 Ultimate SP2 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
save a copy | Excel Programming | |||
Save a copy? | Excel Worksheet Functions | |||
want to save a copy as text , not save the original as text | Excel Programming | |||
Save column J only using copy/paste & temporary copy | Excel Programming | |||
How to save a file without overwrite or save a copy? | Setting up and Configuration of Excel |