Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Linking Textbox and cell

Is there a way to link a Textbox in one worksheet to a cell in another
worksheet, such that text entered in the cell automatically appears in the
Textbox?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Linking Textbox and cell

Hi,

This assumes entry cell (A1) is in Sheet2 and textbox on Sheet1. Change
these as required

Add this code to Sheet2 by right clicking on sheet tab and selecting "view
code".

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo Errorhandler
If Target.Address = "$A$1" Then
Application.EnableEvents = False
Worksheets("Sheet1").TextBox1.Value = Target.Value
End If
Errorhandler:
Application.EnableEvents = True
End Sub


HTH


"Phil Hageman" wrote:

Is there a way to link a Textbox in one worksheet to a cell in another
worksheet, such that text entered in the cell automatically appears in the
Textbox?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Linking Textbox and cell

Hi Toppers,

Thanks for your reply.

Put the code in worksheet "C1" where the text-entry cell is a merged cell,
M7. The target Textbox is "Textbox1" in worksheet named "Strategy Map".

When typing text in M7, nothing changes in the Textbox. Is the merged cell
the problem? No error messages. I need this to work any time the user makes
an entry in M7.

Here is how I modified the code:

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo Errorhandler
If Target.Address = "$M$7" Then
Application.EnableEvents = False
Worksheets("Strategy Map").TextBox1.Value = Target.Value
End If
Errorhandler:
Application.EnableEvents = True
End Sub

Thanks, Phil


"Toppers" wrote:

Hi,

This assumes entry cell (A1) is in Sheet2 and textbox on Sheet1. Change
these as required

Add this code to Sheet2 by right clicking on sheet tab and selecting "view
code".

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo Errorhandler
If Target.Address = "$A$1" Then
Application.EnableEvents = False
Worksheets("Sheet1").TextBox1.Value = Target.Value
End If
Errorhandler:
Application.EnableEvents = True
End Sub


HTH


"Phil Hageman" wrote:

Is there a way to link a Textbox in one worksheet to a cell in another
worksheet, such that text entered in the cell automatically appears in the
Textbox?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Linking Textbox and cell

Phil,
Your code worked for me - I merged cells M7 & M8. Run this line of
code before you test to ensure the Worksheet _Change will kick-off.:

Sub X()
Application.EnableEvents=True
end Sub


And I defined the Textbox using the Control toolbox.

HTH

"Phil Hageman" wrote:

Hi Toppers,

Thanks for your reply.

Put the code in worksheet "C1" where the text-entry cell is a merged cell,
M7. The target Textbox is "Textbox1" in worksheet named "Strategy Map".

When typing text in M7, nothing changes in the Textbox. Is the merged cell
the problem? No error messages. I need this to work any time the user makes
an entry in M7.

Here is how I modified the code:

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo Errorhandler
If Target.Address = "$M$7" Then
Application.EnableEvents = False
Worksheets("Strategy Map").TextBox1.Value = Target.Value
End If
Errorhandler:
Application.EnableEvents = True
End Sub

Thanks, Phil


"Toppers" wrote:

Hi,

This assumes entry cell (A1) is in Sheet2 and textbox on Sheet1. Change
these as required

Add this code to Sheet2 by right clicking on sheet tab and selecting "view
code".

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo Errorhandler
If Target.Address = "$A$1" Then
Application.EnableEvents = False
Worksheets("Sheet1").TextBox1.Value = Target.Value
End If
Errorhandler:
Application.EnableEvents = True
End Sub


HTH


"Phil Hageman" wrote:

Is there a way to link a Textbox in one worksheet to a cell in another
worksheet, such that text entered in the cell automatically appears in the
Textbox?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default Linking Textbox and cell

Hi Phil,

one way I've been able to do that is to edit the code of the textbox and do

Private Sub TextBox1_Change()
sheets("TargetSheetName").range("A1").value=textbo x1.value
End Sub



"Phil Hageman" wrote:

Is there a way to link a Textbox in one worksheet to a cell in another
worksheet, such that text entered in the cell automatically appears in the
Textbox?



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default Linking Textbox and cell

woops - i guess i'm a little dislexic this morning - i did the reverse of
what you wanted. Looks like Toppers got it!

J

"Phil Hageman" wrote:

Is there a way to link a Textbox in one worksheet to a cell in another
worksheet, such that text entered in the cell automatically appears in the
Textbox?

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
Linking a textbox to a cell in another workbk amelia Excel Discussion (Misc queries) 2 April 7th 09 07:06 AM
Linking a textbox to a cell in another workbk amelia Excel Discussion (Misc queries) 4 April 5th 09 05:28 AM
Linking textbox and graphs frustratedwthis Excel Discussion (Misc queries) 1 May 3rd 05 02:53 PM
HELP! I Lost The Ability To Advance From TextBox To TextBox With the ENTER Or The TAB Keys Minitman[_4_] Excel Programming 0 February 22nd 05 08:50 PM
Textbox Bug? Missing/delayed update of textbox filled via VBA MarcM Excel Programming 0 November 4th 04 05:43 PM


All times are GMT +1. The time now is 11:22 AM.

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

About Us

"It's about Microsoft Excel"