VBA to Save Excel sheet as New workbook with file name and +1

FaizanRoshan

Board Regular
Joined
Jun 11, 2015
Messages
54
Hi Every One,

I have User Form to enter data in master wb sheet ("Arabic Form").

What i want to save master wb sheet ("Arabic Form") SaveAs new workbook with sheet name("Arabic Form +1") every time i save sheet it increase number.
ex. First save sheet name ("Arabic Form 1") , second time save sheet name (" Arabic From 2") and so on.

Please help if any one know easy way to done it.

Thank you for help.
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
There may be other ways to accomplish this but this works

Don't forget to backup your work before running a macro

Code:
Sub AFsave()


[COLOR=#0000ff]Dim[/COLOR] wb [COLOR=#0000ff]As[/COLOR] Workbook
Sheets("Arabic Form").Copy
[COLOR=#0000ff]Set[/COLOR] wb = ActiveWorkbook
[COLOR=#0000ff]With[/COLOR] wb
.SaveAs "Arabic Form " & Range("[COLOR=#ff0000]A1[/COLOR]") [COLOR=#008000]'Change A1 to whichever cell you want to use as a counter (place the first save number in that cell)[/COLOR]
[COLOR=#0000ff]End With[/COLOR]
Workbooks("[COLOR=#ff0000]Workbook1.xlsm[/COLOR]").Activate [COLOR=#008000]'change Workbook1.xlsm to whatever your original filename and extension is[/COLOR]
Range("[COLOR=#ff0000]A1[/COLOR]") = 1 + Range("[COLOR=#ff0000]A1[/COLOR]") [COLOR=#008000]'change both A1's to whatever cell you chose for your counter[/COLOR]
End Sub

Let me know if you have any problems

Coops
 
Last edited:
Upvote 0

Forum statistics

Threads
1,226,285
Messages
6,190,055
Members
453,591
Latest member
plengeb

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