ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   creatin new sheet macro (https://www.excelbanter.com/excel-programming/375381-creatin-new-sheet-macro.html)

Calle

creatin new sheet macro
 
Hi!
Is it possible to have a macro that creat a new sheet and puts it first in
the workbook like this:

I have one sheet named: kvartal1
The macro creats a sheet named kvartal2. If I run it again it creats
kvartal3... and so on.

WhytheQ

creatin new sheet macro
 
This might work for you:

'+++++++++++++++++++++++++
Dim mySheet As Worksheet
Set mySheet = Sheets.Add(Sheets(1))
mySheet.Name = "Kvartal" & Sheets.Count
'+++++++++++++++++++++++++

Rgds
J

On Oct 18, 1:36 pm, Calle wrote:
Hi!
Is it possible to have a macro that creat a new sheet and puts it first in
the workbook like this:

I have one sheet named: kvartal1
The macro creats a sheet named kvartal2. If I run it again it creats
kvartal3... and so on.



Calle

creatin new sheet macro
 
hi!
it get named "kvartal 10" since I also have many other sheets. Any other
suggestion

Regards Calle

Tom Ogilvy

creatin new sheet macro
 
Dim mySheet As Worksheet
Set mySheet = Sheets.Add(Sheets(1))
mySheet.Name = "Kvartal" & Sheets.Count - 9

--
Regards,
Tom Ogilvy


"Calle" wrote in message
...
hi!
it get named "kvartal 10" since I also have many other sheets. Any other
suggestion

Regards Calle





All times are GMT +1. The time now is 10:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com