Insert sheet.

  • Thread starter Thread starter Pierre
  • Start date Start date
P

Pierre

Wy get a and error
CompileError:
can find the method or the fact member?

Sub TabbladRechtsInvoegen()
' Find how many sheets are in the workbook
Dim No_Sheets
No_Sheets = Sheets.Count
' Add a new sheet
Sheets.Add
' The new sheet is the active sheet. Move it to after the last Sheet
ActiveSheet.Move After:=Sheets(No_Sheets + 1)
End Sub

JP
 
The code works in a new workbook with Excel 2003. I would try opening a new
workbook like I did and run just the code you posted and see if you still get
an error.
 
I'm using Excel 2003 and don't get an error. I would modify it a bit though.

Sub TabbladRechtsInvoegen()

Dim aWB As Workbook
Dim aWS As Worksheet

Set aWB = ActiveWorkbook
' Add a new sheet
Set aWS = aWB.Sheets.Add
' The new sheet is the active sheet. Move it to after the last Sheet
aWS.Move After:=aWB.Sheets(awb.sheets.count)
End Sub

HTH,
Barb Reinhardt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top