Macro to create a worksheet and Sum values from each previous sheet created.

oscarh02

New Member
Joined
Aug 28, 2017
Messages
3
Hello! Thank you in advance for your time!!

I need to generate a macro that creates a new worksheet, SUM values from each previous sheet done made and also define the number of sheets will be created. Besides I want the name of that new sheet be related to the result of the SUM

e.g.

On Sheet1 A1=1
On Sheet2 A1=2 (from Sheet1A1+1) (Sheet2 will be named 2)
So on Sheet3 A1=3 (from Sheet2A1+1) (Sheet3 will be named 3)

Looking forward your help.

Again, thank you very much!

Kind Regards.
 

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,)
Code:
Sub v()
Worksheets.Add.Name = Sheets.Count + 1
[A1] = Sheets.Count
End Sub
 
Upvote 0
Hi footoo, thank you very much for your help. is it possible to create a macro that SUM alphanumeric values?
e.g. AA1 on Sheet1
AA2 on sheet2?

Again, thank you very much!
 
Upvote 0
Code:
Sub v()
Worksheets.Add.Name = "AA" & Sheets.Count + 1
[A1] = "AA" & Sheets.Count
End Sub

Or perhaps :
Code:
Sub v()
Dim s$, i%, ns$
s = Sheet1.Name
For i = 1 To Len(s)
    If Not IsNumeric(Mid(s, i, 1)) Then ns = ns & Mid(s, i, 1)
Next
Worksheets.Add.Name = ns & Sheets.Count + 1
[A1] = ns & Sheets.Count
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,910
Messages
6,175,318
Members
452,634
Latest member
cpostell

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