• Save as based on the content of a cell (Excel 2002)

    Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Save as based on the content of a cell (Excel 2002)

    Author
    Topic
    #426041

    Is there a way to save an excel file based on the content of a particular cell. If Cell A1 is currently selected and contains the text “Curriculum0506” then save as Curriculum0506.xls in a directory path c:curriculum? TIA

    Viewing 0 reply threads
    Author
    Replies
    • #983329

      Do you want to use the content of A1 as name, or the content of the active cell?

      You could create a macro, and assign it to a xommand button on the sheet, and/or a custom toolbar button and/or a custom keyboard shortcut:

      Sub SaveAsCell()
      Dim strName As String

      On Error GoTo ErrHandler

      strName = ActiveCell.Value ‘ see comment below
      If strName = “” Then
      MsgBox “Enter a name, then try again.”, vbInformation
      Exit Sub
      End If

      ActiveWorkbook.SaveAs “C:Curriculum” & strName & “.xls”
      Exit Sub

      ErrHandler:
      MsgBox Err.Description, vbExclamation
      End Sub

      Note: if you want to use cell A1 on sheet Sheet1 instead of the active cell, use

      strName = Worksheets(“Sheet1”).Range(“A1”).Value

      • #983337

        Excellent solution Hans and you’ve covered both angles as well. Thanks for the timely solution cheers!!!

    Viewing 0 reply threads
    Reply To: Save as based on the content of a cell (Excel 2002)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: