Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I have two workbooks open. Let's call them WkBookA and WkBookB. Cell B1 in WkBookB is linked to cell A1 in WkBookA. Hence when I change the text in A1 in WkBookA, the text in B1 in WkBookB chnages. I want, that when the user changes the text in A1 in WkBookA, and the text subsequently changes in B1 in WkBookB, that some code is triggered. I have the code that works, but it doesn't work unless the user changes the information directly in WkBookB. In other words WkBookA is the focus obviously when you are changing the text in A1, so WkBookB doesn't have the focus and so the following code doesn't work: Private Sub Worksheet_Change(ByVal Target As Range) Dim myexcel As Object Dim myworkbook As Object Dim myworksheet As Object Dim wkbook As Workbook Set myexcel = GetObject(, "Excel.Application") 'Point to active excel application If Target.Address = "$B$1" Then Set myworkbook = Excel.Application.Workbooks("IRReports.xls") Set myworksheet = myworkbook.Worksheets("PIR-DT DAY") 'Here is where the code would go to do what I want to do myworksheet.Range("C1").Value = "Changed" End If End Sub But like I said when I'm changing the text in A1 in WkBookA and the focus is on WkBookA, the Private Sub Worksheet_Change(ByVal Target As Range) in WkBookB isn't triggered -- suzetter ------------------------------------------------------------------------ suzetter's Profile: http://www.excelforum.com/member.php...fo&userid=7078 View this thread: http://www.excelforum.com/showthread...hreadid=379438 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Need to determine where a change in table occurs | Excel Discussion (Misc queries) | |||
conditional cell shading when a change occurs | Excel Discussion (Misc queries) | |||
Why does this code take so long to execute. | Excel Programming | |||
When does Code Execute on a List Box? | Excel Programming | |||
execute code for all 12 months | Excel Programming |