Macro to save active Sheet as new workbook, ask user for location and remove macros from the new workbook

前端 未结 3 1218
时光说笑
时光说笑 2021-01-20 03:50

I have a Workbook with three WorkSheets: Product , Customer, Journal. What I need is a macro assigned to a button within each one of the above Sheets. If the button is click

3条回答
  •  一个人的身影
    2021-01-20 04:18

    To piggyback on Lunatik's suggestion, you might add this:

    MyPath = Application.GetSaveAsFilename(FILEFILTER:="Excel Files (*.xls), *.xls", Title:="Something really clever about saving")
    
    If MyPath <> False Then
        ActiveWorkbook.SaveAs (MyPath)
    End If
    

    GetSaveAsFilename returns FALSE if the user hits cancel. You can also supply a default filename.

    This is a taste thing, but Format(Date, "dd.mm.yyyy") could replace your method.

提交回复
热议问题