PDA

View Full Version : Solved: CSV Files



khalid79m
03-12-2009, 07:51 AM
I need help in building a macro, that will select b3 to h3 and lastrow (lastrow can be located using column B) and convert to a csv file and save it to z:\csvfiles\

Can anyone help?

nirvana_1
03-18-2009, 01:49 PM
select range from b3 to h3 till last row. copy it to a new worksheet. then export as csv.

mdmackillop
03-18-2009, 02:07 PM
Option Explicit
Sub Macro1()
Dim SaveName As String
SaveName = "C:\AAA\Book3.csv" '<== Change to suit

Application.DisplayAlerts = False
Range(Cells(3, 2), Cells(Rows.Count, 2).End(xlUp)).Resize(, 7).Copy
Sheets.Add
With ActiveSheet
.Paste
.Copy
End With
With ActiveWorkbook
.SaveAs Filename:=SaveName, FileFormat:=xlCSVMSDOS
.Close
End With
ActiveSheet.Delete
Application.DisplayAlerts = True
End Sub

khalid79m
03-24-2009, 04:57 AM
:yes That worked a treat