ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   adding worksheet with spcific name (https://www.excelbanter.com/excel-programming/278231-adding-worksheet-spcific-name.html)

SotjeRuud

adding worksheet with spcific name
 
Hi there,

Can anyone help me with the code to add a worksheet in an excelsheet with a
specific name?
The name should be "data sheet"

thx in advance
Ruud



Filip Mateasko

adding worksheet with spcific name
 
Hi, try this

Workbooks.Add
ActiveSheet.Name = "data sheet"

Filip

"SotjeRuud" píše v diskusním příspěvku
...
Hi there,

Can anyone help me with the code to add a worksheet in an excelsheet with

a
specific name?
The name should be "data sheet"

thx in advance
Ruud





Filip Mateasko

adding worksheet with spcific name
 
Sorry,
once more and better:

Sheets.Add
ActiveSheet.Name = "LongProfile"

In the first case I added workbook

Cus :-)

Filip


"SotjeRuud" píše v diskusním příspěvku
...
Hi there,

Can anyone help me with the code to add a worksheet in an excelsheet with

a
specific name?
The name should be "data sheet"

thx in advance
Ruud





keepITcool

adding worksheet with spcific name
 
Ruud,

following should get u on your way..

Sub AddDataSheet()
Dim ws As Worksheet

On Error Resume Next
Set ws = Worksheets("data sheet")
On Error GoTo 0
If ws Is Nothing Then
Set ws = Worksheets.Add
ws.Name = "data sheet"
Else
'handle sheet exists here
End If
End Sub


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"SotjeRuud" wrote:

Hi there,

Can anyone help me with the code to add a worksheet in an excelsheet
with a specific name?
The name should be "data sheet"

thx in advance
Ruud






All times are GMT +1. The time now is 10:31 AM.

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