Variable Control Names
Here's one way:
'-------
Sub setar(ArgValue As Integer)
Worksheets("Sheet" & ArgValue).Name = "NewName"
End Sub
'-------
HTH
Anders Silvén
"Garry Jones" skrev i meddelandet
...
Mark Bigelow wrote:
Let me know if that doesn't work.
It worked, thanks. (Thanks to Anders as well).
Okay, next problem, similar.
I want to decide which worksheet to name with a variable
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
____________________________________________
What I want from the code is is
Sheet1.Name = "NewName"
Garry Jones
|