ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   VBA Sheets.Add disabled (https://www.excelbanter.com/excel-worksheet-functions/229472-vba-sheets-add-disabled.html)

Willem

VBA Sheets.Add disabled
 
Hi,

We recently upgraded from Office 2003 to Office 2007. In some macro's errors
start occurring, e.g. the Excel macro that adds an extra sheet to a workbook,
and always worked flawless, now stops running.
Also i cannot add a worksheet manually; I can see the tab but it is disabled.
The workbook consists of several (protected) worksheets.
The macro is very simple:
Sub MakeSheet()
' Application.ScreenUpdating = False
Sheets.Add
ActiveSheet.Name = "exporteren data"
End Sub

What can be the problem?

Jacob Skaria

VBA Sheets.Add disabled
 
Try specifying the Workbook name

Workbooks("Book1").Sheets.Add
Workbooks("Book1").ActiveSheet.Name = "exporteren data"

If this post helps click Yes
---------------
Jacob Skaria


"Willem" wrote:

Hi,

We recently upgraded from Office 2003 to Office 2007. In some macro's errors
start occurring, e.g. the Excel macro that adds an extra sheet to a workbook,
and always worked flawless, now stops running.
Also i cannot add a worksheet manually; I can see the tab but it is disabled.
The workbook consists of several (protected) worksheets.
The macro is very simple:
Sub MakeSheet()
' Application.ScreenUpdating = False
Sheets.Add
ActiveSheet.Name = "exporteren data"
End Sub

What can be the problem?


Willem

VBA Sheets.Add disabled
 
Thanks for your prompt reaction, Jacob.
It won't work, because the file I.m talking about is a template (xltm) and
the users name it themselves.
I have another workbook using the same macro's, and this does not give this
problem. In the other wb i can add sheets, and in thois one it is disavbled
but i don't see how.


"Jacob Skaria" wrote:

Try specifying the Workbook name

Workbooks("Book1").Sheets.Add
Workbooks("Book1").ActiveSheet.Name = "exporteren data"

If this post helps click Yes
---------------
Jacob Skaria


"Willem" wrote:

Hi,

We recently upgraded from Office 2003 to Office 2007. In some macro's errors
start occurring, e.g. the Excel macro that adds an extra sheet to a workbook,
and always worked flawless, now stops running.
Also i cannot add a worksheet manually; I can see the tab but it is disabled.
The workbook consists of several (protected) worksheets.
The macro is very simple:
Sub MakeSheet()
' Application.ScreenUpdating = False
Sheets.Add
ActiveSheet.Name = "exporteren data"
End Sub

What can be the problem?


muddan madhu

VBA Sheets.Add disabled
 
May be the workbook is protected.

Go to Revew tab | protect workbook | any tick is there for protect
structure and windows | then its protected.

If its not protected then, check the sheet named "exporteren data" is
already exist.

Sub makesheet()
Sheets.add.name = "exporteren data"
end sub

On May 1, 5:19*pm, Willem wrote:
Hi,

We recently upgraded from Office 2003 to Office 2007. In some macro's errors
start occurring, e.g. the Excel macro that adds an extra sheet to a workbook,
and always worked flawless, now stops running.
Also i cannot add a worksheet manually; I can see the tab but it is disabled.
The workbook consists of several (protected) worksheets.
The macro is very simple:
Sub MakeSheet()
' * *Application.ScreenUpdating = False
* * Sheets.Add
* * ActiveSheet.Name = "exporteren data"
End Sub

What can be the problem?



Willem

VBA Sheets.Add disabled
 
yes, thanks. I feel so silly.......
the box for style protectiuon was ticked.
it works like it always did......

thanks again


"muddan madhu" wrote:

May be the workbook is protected.

Go to Revew tab | protect workbook | any tick is there for protect
structure and windows | then its protected.

If its not protected then, check the sheet named "exporteren data" is
already exist.

Sub makesheet()
Sheets.add.name = "exporteren data"
end sub

On May 1, 5:19 pm, Willem wrote:
Hi,

We recently upgraded from Office 2003 to Office 2007. In some macro's errors
start occurring, e.g. the Excel macro that adds an extra sheet to a workbook,
and always worked flawless, now stops running.
Also i cannot add a worksheet manually; I can see the tab but it is disabled.
The workbook consists of several (protected) worksheets.
The macro is very simple:
Sub MakeSheet()
' Application.ScreenUpdating = False
Sheets.Add
ActiveSheet.Name = "exporteren data"
End Sub

What can be the problem?




Jacob Skaria

VBA Sheets.Add disabled
 
Cheers. Good to hear that...

If this post helps click Yes
---------------
Jacob Skaria


"Willem" wrote:

yes, thanks. I feel so silly.......
the box for style protectiuon was ticked.
it works like it always did......

thanks again


"muddan madhu" wrote:

May be the workbook is protected.

Go to Revew tab | protect workbook | any tick is there for protect
structure and windows | then its protected.

If its not protected then, check the sheet named "exporteren data" is
already exist.

Sub makesheet()
Sheets.add.name = "exporteren data"
end sub

On May 1, 5:19 pm, Willem wrote:
Hi,

We recently upgraded from Office 2003 to Office 2007. In some macro's errors
start occurring, e.g. the Excel macro that adds an extra sheet to a workbook,
and always worked flawless, now stops running.
Also i cannot add a worksheet manually; I can see the tab but it is disabled.
The workbook consists of several (protected) worksheets.
The macro is very simple:
Sub MakeSheet()
' Application.ScreenUpdating = False
Sheets.Add
ActiveSheet.Name = "exporteren data"
End Sub

What can be the problem?





All times are GMT +1. The time now is 12:29 AM.

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