Results 1 to 18 of 18

VBA_Help

Threaded View

  1. #7
    Registered User
    Join Date
    06-16-2024
    Location
    Dubai, UAE
    MS-Off Ver
    2019
    Posts
    31

    Re: VBA_Help

    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
    Last edited by Nyay; 06-17-2024 at 10:05 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1