View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Marty Marty is offline
external usenet poster
 
Posts: 116
Default Easy One - Syntax for variables in TextBox & Label names

Hello:

What is the correct syntax for including a variable (in this case "i") in
the name of a TextBox and/or Label?

I have a list of TextBoxes and Labels on a userform and I want to program a
reset button to change what is displayed back to the defaults. I need
something like this:

Private Sub CommandButton8_Click()
For i = 1 To 13
TextBox(i).Text = "0"
Label(i).Caption = "N/A"
Next i
End Sub

I'm getting a Sub or Function not defined error, and I know it's because the
syntax is wrong. Help is appreciated.

Thanks,
MARTY