View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Incidental Incidental is offline
external usenet poster
 
Posts: 226
Default Syntax for TextBox ControlSource Property to another worksheet

Hi

You could try activating the the worksheet before you set the control
source

this code takes the value from cell a1 on the three sheets of a
workbook and shows them in a different textbox each

Private Sub CommandButton1_Click()

Sheets("sheet1").Activate
TextBox1.ControlSource = "A1"

Sheets("sheet2").Activate
TextBox2.ControlSource = "A1"

Sheets("sheet3").Activate
TextBox3.ControlSource = "A1"

End Sub

hope this is of some use to you

S

jam9663 wrote:
I am trying to set a TextBox ControlSource from a UserForm to link to a
different worksheet..... I use the syntax UserForm.TextBoxxxx.ControlSource =
Worksheets(#).Range("Cell#") yet when I go to run it I keep getting an error
message. What would be the correct syntax for this....or can I even do this
with VB???