I need to create a button that saves a modified document as a number in a particular cell (e.g in A6).
Private Sub CommandButton1_Click() '.xlsm or xls depending if you want to save the macros. ActiveWorkbook.SaveAs Filename:="c:\archive\" & Cells(1, 6) & ".xlsm" Cells(1, 5) = "Archived" If Cells(1, 5) = "Archived" Then CommandButton1.Visible = False End If End Sub
Thanks to f894009 for this tip.
- VBA - A button to save filename of a document to a cell
- Adding a VBA Command Button - How-To - Excel
- VBA - A macro to remove part of the data contained in cells - How-To - Excel
- Excel/VBA - A macro change page in a Word document - How-To - Excel
- Modified code create subfolder and save as pdf to it based on cell ✓ - Forum - Excel
- Vba to copy and paste a range multiple times based on cell value ✓ - Forum - Excel
This document, titled « VBA - A button to save filename of a document to a cell », is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).