Set ws = .Sheets.Add(After:=.Sheets(Sheets.Count), _
Type:="worksheet", Count:=1)
This syntax is used in Microsoft examples, see e.g.: http://support.microsoft.com/kb/165238. On some other versions this may fail however with a message: "runtime error 1004" --- "worksheet.xls can not be found". More reliable is:
Set ws = .Sheets.Add(After:=.Sheets(Sheets.Count), _
Type:=xlWorksheet, Count:=1)
No comments:
Post a Comment