Hi,
I am trying to save a range from a specific worksheet within a macro enabled workbook. I would like to export the range, leaving all data intact after saving. I would also like to save the csv in the same location as the workbook.
I've got this far on my VBA script so far, can anyone please assist? It's not working at all
I am trying to save a range from a specific worksheet within a macro enabled workbook. I would like to export the range, leaving all data intact after saving. I would also like to save the csv in the same location as the workbook.
I've got this far on my VBA script so far, can anyone please assist? It's not working at all
VBA Code:
Sub SaveAsCSV()
Dim wb As Workbook
Dim nam As String
Application.DisplayAlerts = False
With Worksheets("Export")
nam = .Range("A1")
.Range("A4:T1000").Copy
End With
Set wb = Workbooks.Add
With wb
ActiveSheet.PasteSpecial
Sub ExampleToSaveWithSamePathDifferentName()
Dim sFilename As String
sFilename = "WorkbookName.xls" 'You can give a nem to save
Workbooks.Add
'Saving the Workbook
ActiveWorkbook.SaveAs ThisWorkbook.Path & "\" & sFilename
End Sub
Last edited by a moderator: