ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Adding Worksheets (https://www.excelbanter.com/excel-programming/288040-adding-worksheets.html)

Peter[_33_]

Adding Worksheets
 
Hi

I am creating an Add-in. This Add-in functions will run on
top of a workbook of data. How do I add a new worksheet in
active workbook with the name "Result" from a function in
the Add-In.
I tried the following but it does not work
ThisWorkBook.Sheets.Add

Also how to ensure that it already does not exist

I use Excel 2002 on Win 2000

Please advise
Thanks a lot

Flemming Dahl

Adding Worksheets
 
Hi Peter

Try ActiveWorkbook.Sheets.Add

Cheers,
Flemming


"Peter" wrote in message
...
Hi

I am creating an Add-in. This Add-in functions will run on
top of a workbook of data. How do I add a new worksheet in
active workbook with the name "Result" from a function in
the Add-In.
I tried the following but it does not work
ThisWorkBook.Sheets.Add

Also how to ensure that it already does not exist

I use Excel 2002 on Win 2000

Please advise
Thanks a lot




Peter[_33_]

Adding Worksheets
 
Thanks but how do I add a sheet with a particular name

-----Original Message-----
Hi Peter

Try ActiveWorkbook.Sheets.Add

Cheers,
Flemming


"Peter" wrote in

message
...
Hi

I am creating an Add-in. This Add-in functions will run

on
top of a workbook of data. How do I add a new worksheet

in
active workbook with the name "Result" from a function

in
the Add-In.
I tried the following but it does not work
ThisWorkBook.Sheets.Add

Also how to ensure that it already does not exist

I use Excel 2002 on Win 2000

Please advise
Thanks a lot



.


Patricia[_3_]

Adding Worksheets
 
Try this:

Set NewSheet = ActiveWorkbook.Sheets.Add
NewSheet.Name = "Results"

Regards,
Patricia
-----Original Message-----
Hi Peter

Try ActiveWorkbook.Sheets.Add

Cheers,
Flemming


"Peter" wrote in

message
...
Hi

I am creating an Add-in. This Add-in functions will run

on
top of a workbook of data. How do I add a new worksheet

in
active workbook with the name "Result" from a function

in
the Add-In.
I tried the following but it does not work
ThisWorkBook.Sheets.Add

Also how to ensure that it already does not exist

I use Excel 2002 on Win 2000

Please advise
Thanks a lot



.


Tom Ogilvy

Adding Worksheets
 
With Activeworkbook.Worksheets
.Add(after:=.count).Name = "ABCD"
End With

--
Regards,
Tom Ogilvy

"Peter" wrote in message
...
Thanks but how do I add a sheet with a particular name

-----Original Message-----
Hi Peter

Try ActiveWorkbook.Sheets.Add

Cheers,
Flemming


"Peter" wrote in

message
...
Hi

I am creating an Add-in. This Add-in functions will run

on
top of a workbook of data. How do I add a new worksheet

in
active workbook with the name "Result" from a function

in
the Add-In.
I tried the following but it does not work
ThisWorkBook.Sheets.Add

Also how to ensure that it already does not exist

I use Excel 2002 on Win 2000

Please advise
Thanks a lot



.




No Name

Adding Worksheets
 
Hi Tom
It gives out the follwoing error

Method add of object 'sheets' failed

Please advise
also once its working how not to add (trap error) if the
name already exist.

Thanks a lot in advance for your help
-----Original Message-----
With Activeworkbook.Worksheets
.Add(after:=.count).Name = "ABCD"
End With

--
Regards,
Tom Ogilvy

"Peter" wrote in

message
...
Thanks but how do I add a sheet with a particular name

-----Original Message-----
Hi Peter

Try ActiveWorkbook.Sheets.Add

Cheers,
Flemming


"Peter" wrote in

message
...
Hi

I am creating an Add-in. This Add-in functions will

run
on
top of a workbook of data. How do I add a new

worksheet
in
active workbook with the name "Result" from a

function
in
the Add-In.
I tried the following but it does not work
ThisWorkBook.Sheets.Add

Also how to ensure that it already does not exist

I use Excel 2002 on Win 2000

Please advise
Thanks a lot


.



.


peter

Adding Worksheets
 
Thanks a lot it worked
-----Original Message-----
Try this:

Set NewSheet = ActiveWorkbook.Sheets.Add
NewSheet.Name = "Results"

Regards,
Patricia
-----Original Message-----
Hi Peter

Try ActiveWorkbook.Sheets.Add

Cheers,
Flemming


"Peter" wrote in

message
...
Hi

I am creating an Add-in. This Add-in functions will

run
on
top of a workbook of data. How do I add a new

worksheet
in
active workbook with the name "Result" from a function

in
the Add-In.
I tried the following but it does not work
ThisWorkBook.Sheets.Add

Also how to ensure that it already does not exist

I use Excel 2002 on Win 2000

Please advise
Thanks a lot



.

.



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

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