View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Serkan[_2_] Serkan[_2_] is offline
external usenet poster
 
Posts: 8
Default Sheetname variable

Sheets(setar).name = "New Name"

when setar = 1
sheet(setar) = first sheet


-----Original Message-----
I would like to name a worksheet, but the worksheet that

shall be named
is dependant upon which button is pressed.

What I want from this code is is

Sheet1.Name = "NewName"

(ie if command button 1 is pressed)

What am I missing here?
____________________________________________

Private Sub CommandButton1_Click()
setar (1)
'when Command Button 1 is clicked it sends the number 1

as a variable to
the code
End Sub
____________________________________________

Private Sub setar(ArgValue as Integer)
("Sheet" & ArgValue).Name = "NewName"
'Missing something here
End Sub
____________________________________________

I am working with Swedish Excel, in Swedish the worksheet

control name
is known as "blad", I seem to remember it was "sheet" in

English, if I
am wrong my posting may be confusing. Maybe

its "worksheet", anyway,
that doesn't really matter, I just need the code and then

I can write
"blad" anyway.


Garry Jones
.