Syntax for TextBox ControlSource Property to another worksheet

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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???
 
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
 
try these -

"'" & sheet-name & "'!" & cell.address

or

mySingleCellRangeObject.address(external:=true)

Regards,
Peter T


jam9663 said:
I am trying to set a TextBox ControlSource from a UserForm to link to a
different worksheet..... I use the syntax
UserForm.TextBoxxxx.ControlSource =
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top