ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   need assist with save as csv code (https://www.excelbanter.com/excel-programming/321129-need-assist-save-csv-code.html)

[email protected]

need assist with save as csv code
 
I have this following code
What I require is at the activeCell.SpecialCells(xlLastCell)
for it to add the next blank row to the selection.
I am having some difficulty with this.
any assistance will be greatly appreciated.
Paul

Sub SaveAsCSV()
'This macro will SAVE AS to C:\Trees folder, which must exist before
macro runs

'
Range("A2").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.Copy
Workbooks.Add
ActiveSheet.Paste
Application.CutCopyMode = False

ActiveWorkbook.SaveAs Filename:="C:\Trees\" & "UP" & Format(Now,
"yymmddhhmm") & ".csv", FileFormat:=xlCSV, _
CreateBackup:=False
ActiveWorkbook.Close SaveChanges:=False


End Sub


Bob Phillips[_6_]

need assist with save as csv code
 
Husky,

Please try this

Sub SaveAsCSV()
'This macro will SAVE AS to C:\Trees folder, which must exist before
macro runs

'
Range("A2").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell).Offset(1,0)).C opy
Workbooks.Add
ActiveSheet.Paste
Application.CutCopyMode = False

ActiveWorkbook.SaveAs Filename:="C:\Trees\" & "UP" & Format(Now,
"yymmddhhmm") & ".csv", FileFormat:=xlCSV, _
CreateBackup:=False
ActiveWorkbook.Close SaveChanges:=False


End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


wrote in message
ups.com...
I have this following code
What I require is at the activeCell.SpecialCells(xlLastCell)
for it to add the next blank row to the selection.
I am having some difficulty with this.
any assistance will be greatly appreciated.
Paul

Sub SaveAsCSV()
'This macro will SAVE AS to C:\Trees folder, which must exist before
macro runs

'
Range("A2").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.Copy
Workbooks.Add
ActiveSheet.Paste
Application.CutCopyMode = False

ActiveWorkbook.SaveAs Filename:="C:\Trees\" & "UP" & Format(Now,
"yymmddhhmm") & ".csv", FileFormat:=xlCSV, _
CreateBackup:=False
ActiveWorkbook.Close SaveChanges:=False


End Sub




[email protected]

need assist with save as csv code
 
Thanks very much Bob,
Works a charm.

Cheers paul



All times are GMT +1. The time now is 07:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com