+ Reply to Thread
Results 1 to 12 of 12

Macros To Save Worksheet as New xlsx file & Save Another Worksheet As A Text File

Hybrid View

  1. #1
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    953

    Re: Macros To Save Worksheet as New xlsx file & Save Another Worksheet As A Text File

    Sub Steffen()
    
    Open "C:\\Users\Path\" & Sheets("Config").Range("C6").Value & ".txt" For Append As #1
        For i = i To Sheets("Config").UsedRange.Rows.Count
            Print #1, Cells(i, 1)
        Next i
    Close #1
    
    On Error GoTo err
    Application.DisplayAlerts = False
    ActiveWorkbook.SaveAs "C:\Users\Path\" & Sheets("Data Sheet").Range("C8").Value & ".xlsx", FileFormat:=51
    err:
    Application.DisplayAlerts = True
    
    End Sub
    *EDIT reason: Wrong fileformat
    Last edited by Steffen Thomsen; 11-16-2011 at 08:10 AM.

  2. #2
    Registered User
    Join Date
    11-05-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Macros To Save Worksheet as New xlsx file & Save Another Worksheet As A Text File

    Hi Steffen,

    Thanks for your reply. I've tried the code but it fails at Print #1, Cells(i, 1)

    Regards

    Keith

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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