Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Feb 2001
    Location
    Tokyo, Japan
    Posts
    203
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    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

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

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

    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

  3. #3
    3 Star Lounger
    Join Date
    Feb 2001
    Location
    Tokyo, Japan
    Posts
    203
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

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

Posting Permissions

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