ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Worksheet Change event (https://www.excelbanter.com/excel-programming/314685-worksheet-change-event.html)

Libby

Worksheet Change event
 
hi All

Heres the situation
Two workbooks, A and B
Workbook B is not allowed to be coded, so I use a button on Workbook A to
open workbook B (so both A and B are open, but B is active).
However, I'd like to make allow alterations to Workbook B using the
worksheet change event. However, since I can't put code in workbook B , I
was wondering if there was a way I could have a change event for workbook B,
in workbook A?

All help appreciated
Libby

Bob Phillips[_6_]

Worksheet Change event
 
Libby,

If it is a change in Workbook A that is to trigger a change to Workbok B,
that is no problem.

If you want a change in Workbook B to trigger some code in Workbook A, it
is difficult if Workbook B can't have code, as you don't catch the event
.... unless you use application events in workbook A

For example, in workbook A

'========================================
Insert a class module, rename it to 'clsAppEvents', with this code

Option Explicit

Public WithEvents App As Application


Private Sub App_WorkbookOpen(ByVal Wb As Workbook)

MsgBox Wb.Name

End Sub

'========================================
In ThisWorkbook code module, add this event code

Dim AppClass As New clsAppEvents

Private Sub Workbook_Open()

Set AppClass.App = Application

End Sub



--

HTH

RP

"Libby" wrote in message
...
hi All

Heres the situation
Two workbooks, A and B
Workbook B is not allowed to be coded, so I use a button on Workbook A to
open workbook B (so both A and B are open, but B is active).
However, I'd like to make allow alterations to Workbook B using the
worksheet change event. However, since I can't put code in workbook B , I
was wondering if there was a way I could have a change event for workbook

B,
in workbook A?

All help appreciated
Libby




Doug Glancy

Worksheet Change event
 
Libby,

I think you could use application level events. See this link for a start:

http://www.cpearson.com/excel/AppEvent.htm

hth,

Doug Glancy

"Libby" wrote in message
...
hi All

Heres the situation
Two workbooks, A and B
Workbook B is not allowed to be coded, so I use a button on Workbook A to
open workbook B (so both A and B are open, but B is active).
However, I'd like to make allow alterations to Workbook B using the
worksheet change event. However, since I can't put code in workbook B , I
was wondering if there was a way I could have a change event for workbook

B,
in workbook A?

All help appreciated
Libby





All times are GMT +1. The time now is 08:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com