Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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???
  #2   Report Post  
Posted to microsoft.public.excel.programming
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???


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default 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???



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
TextBox ControlSource marwan[_2_] Excel Programming 0 September 19th 05 06:18 PM
ControlSource in a userform textbox Ian Mangelsdorf Excel Programming 1 October 18th 04 01:17 PM
Textbox ControlSource Property - Excel 97 Tom Ogilvy Excel Programming 0 June 17th 04 09:45 PM
last piece of the puzzle...controlsource in textbox bruce forster Excel Programming 2 April 19th 04 10:45 AM
Problem with TextBox & ControlSource - Please Help [email protected] Excel Programming 8 January 14th 04 06:45 AM


All times are GMT +1. The time now is 02:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"