Hello,
I have an excel file with 7 sheets. I would like to write a code for creating a sheet at the end of the file (number 8).
I wrote the following:
Dim xlSheet As Excel.Worksheet
Set xlSheet = Worksheets.Add(,"Service")
xlSheet.Name = "My Sheet"
I wrote Service, because the 7th sheet name is "Service", and i wanted to put the new sheet after this. But it didn't work out for me.
I managed to do it, in the following way:
Worksheets.Add Before:=Worksheets("Sheet3")
activesheet.Name = "My Sheet"
But i would like to do it with my first method.
Any suggestions?
Thank you.
I have an excel file with 7 sheets. I would like to write a code for creating a sheet at the end of the file (number 8).
I wrote the following:
Dim xlSheet As Excel.Worksheet
Set xlSheet = Worksheets.Add(,"Service")
xlSheet.Name = "My Sheet"
I wrote Service, because the 7th sheet name is "Service", and i wanted to put the new sheet after this. But it didn't work out for me.
I managed to do it, in the following way:
Worksheets.Add Before:=Worksheets("Sheet3")
activesheet.Name = "My Sheet"
But i would like to do it with my first method.
Any suggestions?
Thank you.