View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bruce Lindsay Bruce Lindsay is offline
external usenet poster
 
Posts: 4
Default Worksheets.Add method

I have tried to add a worksheet with the following code.

dim oDoc as Workbook
dim oSht as Worksheet

Set oDoc = Application.ThisWorkbook
oSht = oDoc.Worksheets.Add

It gives an error #1004. I have tried it in many variations but all fail.
Some even create the sheet but still error out. Any help would be
appreciated.