WhatsApp Image 2024-06-17 at 19.22.54_a8cb6de1.jpg
Hi I have enabled macros in the above file but still getting the issue. Please help as I face this issue quite a few time
Sub cmdSave()
Dim sFileName As String
Dim WB As Workbook
Dim LastRow As Long
Application.DisplayAlerts = False
sFileName = "MyFileName.csv"
LastRow = ws.UsedRange.Rows.Count
'Copy the contents of required sheet ready to paste into the new CSV
Sheets(1).Range("A1:U" & LastRow).CurrentRegion.Copy 'Define your own range if required
'Open a new XLS workbook, save it as the file name
Set WB = Workbooks.Add
With WB
.Title = "MyTitle"
.Subject = "MySubject"
.Sheets(1).Select
ActiveSheet.Paste
.Saveas "D:\Downloads\Excel" & sFileName, xlCSV
.Close
End With
Application.DisplayAlerts = True
End Sub
For SaveAs query which is attached in the Module 2, I tried changing the range but it is showing me debug. Please help
Bookmarks