Syntax for TextBox ControlSource Property to another worksheet
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??? |
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??? |
Syntax for TextBox ControlSource Property to another worksheet
try these -
"'" & sheet-name & "'!" & cell.address or mySingleCellRangeObject.address(external:=true) Regards, Peter T "jam9663" wrote in message ... 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??? |
All times are GMT +1. The time now is 02:49 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com