![]() |
Worksheets.Add
I have code in my workbook code that attempts to create a new sheet when the
workbook opens. I used: set oDoc = Workbooks.thisWorkbook oSht = oDoc.Add(after:=1) I get an error 1004. It doesn't add a sheet. Do I need to declare the workbook and sheet object? Bruce |
Worksheets.Add
Dim oDoc As Workbook Dim oSht As Worksheet Set oDoc = Application.ThisWorkbook Set oSht = oDoc.Worksheets.Add(after:=oDoc.Worksheets(1)) -- Regards, Tom Ogilvy Bruce Lindsay wrote in message ... I have code in my workbook code that attempts to create a new sheet when the workbook opens. I used: set oDoc = Workbooks.thisWorkbook oSht = oDoc.Add(after:=1) I get an error 1004. It doesn't add a sheet. Do I need to declare the workbook and sheet object? Bruce |
All times are GMT +1. The time now is 08:30 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com