Saving Work in Excel

  graham-187500 13:32 12 May 2008
Locked

Hi All, When saving a workbook does anyone know if there is a way of copying and pasting a particular cell to make it appear as part of the filename. It would appear that Excel doesn’t allow you to paste into the SaveAs dialogue box. I’ve tried right hand clicking Copy and Paste and the Ctrl+c, Ctrl+V route to no avail. Any help would be most appreciated.

  Eric10 13:48 12 May 2008

So long as the cell doesn't contain a formula you can copy it by clicking the cell and highlighting the text from the formula bar at the top and copying it. This can then be pasted into the Save As box. If the cell contains a formula you will just copy the formula rather than the result of the formula.

  VoG II 13:57 12 May 2008

You can do this using code. Right click the Excel logo just to the left of File on the menu bar and select View Code. Copy and paste in


Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If SaveAsUI = True Then
Cancel = True
ThisWorkbook.SaveAs Filename:=ThisWorkbook.Path & "\" & Sheets("Sheet1").Range("A1").Value & ".xls"
End If
End Sub
[/code]

Change the sheet name and cell reference to suit, then close the code window using the X.

Now if you select File > Save As the file will be saved with the name in A1 as the filename in the same folder as the original file. You will get a warning if the file already exists.

  VoG II 13:58 12 May 2008

Disregard [/code] in the above - I forgot which forum I was in :o)

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

Xiaomi Mi Mix 2 review

What went wrong at the Designs of the Year 2017

iPhone X news: Release date, price, new features & specs

Comment créer, modifier et réinitialiser un compte Apple ?