+ Reply to Thread
Results 1 to 6 of 6

MACRO save active sheet wth name from selected cell and without macros and buttons

  1. #1
    Forum Contributor
    Join Date
    12-13-2012
    Location
    Italy
    MS-Off Ver
    Excel 2010
    Posts
    162

    Question MACRO save active sheet wth name from selected cell and without macros and buttons

    Good day,

    I need a macro that saves active sheet in selected folder with name from cell A# without macros and button.

    Bellow code should do that:


    Sub SaveScreeningWithNewName()
    Dim NewFN As Variant
    ' Copy Screening to a new workbook
    Sheets(Array("SUM")).Copy
    ActiveSheet.Shapes.Range(Array("CommandButton1")).Delete
    NewFN = "C:\Users\" & Range("A3").Text & ".xlsx"
    ActiveWorkbook.SaveAs NewFN, FileFormat:=xlOpenXMLWorkbook
    ActiveWorkbook.Close


    End Sub
    But is not working...i don't know what am I missing..can somebody help me?

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: MACRO save active sheet wth name from selected cell and without macros and buttons

    How does the code not work?
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    12-13-2012
    Location
    Italy
    MS-Off Ver
    Excel 2010
    Posts
    162

    Re: MACRO save active sheet wth name from selected cell and without macros and buttons

    Run-time Error 1004..see attached image:

    excelerror.jpg

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: MACRO save active sheet wth name from selected cell and without macros and buttons

    What's in A3 of the active sheet when you get the error?

  5. #5
    Forum Contributor
    Join Date
    12-13-2012
    Location
    Italy
    MS-Off Ver
    Excel 2010
    Posts
    162

    Re: MACRO save active sheet wth name from selected cell and without macros and buttons

    cell A3 is full of text that it has to be a name of saved file.

  6. #6
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: MACRO save active sheet wth name from selected cell and without macros and buttons

    Ok

    In this workbook there is a sheet specific macro on sheet: Main2

    leaving that sheet will save Main2 to a folder called pics on the desktop using the name in cell a1.

    I havn't time at the momenr to check if that folder exists and to create it for you. [ Will do that in a couple of hours when I get back. ]

    Right click on main2 at the bottom of excel to view the code.

    Enjoy.
    Attached Files Attached Files

+ 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