adjusting code save as each sheet by choose inputbox

abdelfattah

Well-known Member
Joined
May 3, 2019
Messages
1,429
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
hello
i have this code to save each sheet to the folder which opened the file but i don't save the home of sheet i would choose specific sheets
VBA Code:
Sub SAVESHEETS()
With Application
    .DisplayAlerts = False
    .ScreenUpdating = False
End With
For Each sh In ThisWorkbook.Worksheets
    sh.Copy
    ActiveWorkbook.SaveAs ThisWorkbook.Path & "\" & ActiveSheet.Name & ".xlsx"
    ActiveWorkbook.Close False
Next
With Application
    .DisplayAlerts = True
    .ScreenUpdating = True
End With
End Sub
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Maybe this will help you ...
VBA Code:
Sub SAVESHEETS()
    Dim sh  As Worksheet
    With Application
        .DisplayAlerts = False
        .ScreenUpdating = False
    End With
    For Each sh In ThisWorkbook.Worksheets
        If MsgBox("Do you want to save this sheet?" & vbCrLf & "[" & sh.Name & "]", vbYesNo, "Saving sheets") = vbYes Then
            sh.Copy
            ActiveWorkbook.SaveAs ThisWorkbook.Path & "\" & ActiveSheet.Name & ".xlsx"
            ActiveWorkbook.Close False
        End If
    Next
    With Application
        .DisplayAlerts = True
        .ScreenUpdating = True
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,212,938
Messages
6,110,788
Members
448,297
Latest member
carmadgar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top