Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Linking a textbox to a cell in another workbk | Excel Discussion (Misc queries) | |||
Linking a textbox to a cell in another workbk | Excel Discussion (Misc queries) | |||
Linking textbox and graphs | Excel Discussion (Misc queries) | |||
HELP! I Lost The Ability To Advance From TextBox To TextBox With the ENTER Or The TAB Keys | Excel Programming | |||
Textbox Bug? Missing/delayed update of textbox filled via VBA | Excel Programming |