adding worksheet with spcific name

  • Thread starter Thread starter SotjeRuud
  • Start date Start date
S

SotjeRuud

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
 
Sorry,
once more and better:

Sheets.Add
ActiveSheet.Name = "LongProfile"

In the first case I added workbook

Cus :-)

Filip
 
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 >
 
Back
Top