ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to determine the worksheet that a calculate event gets initiated on when the workbook is not active (https://www.excelbanter.com/excel-programming/389364-how-determine-worksheet-calculate-event-gets-initiated-when-workbook-not-active.html)

Riddler

How to determine the worksheet that a calculate event gets initiated on when the workbook is not active
 
I have 2 workbooks thats are linked with a cell reference. I make a
cell change on book1 and a cell in book 2 changes. I want to be able
to get the name of the sheet that the calculate event runs on in book2
to hide rows that do not contain values. Currently my code runs on the
Worsheet_calculate event but book1 is the active workbook even though
the cacluate code that runs is in book2. The problem is that this code
looks at book1 cell values to hide or show rows not the cells in book2
on the specific sheet. I dont want to code in the sheet names either
as they may and will change and there are many sheet.
Basically I am looking to get the name of the sheet that the calculate
event is running because of with the workbook not being active.

Thanks
Scott


Riddler

How to determine the worksheet that a calculate event gets initiated on when the workbook is not active
 
I did find this code to work.
Private Sub Worksheet_Calculate()
MsgBox Sheet1.Name
End Sub

The only thing I had to change "Sheet1" to match the sheet it was on.
It works at least.

Scott


Riddler

How to determine the worksheet that a calculate event gets initiated on when the workbook is not active
 
Yes, I wo9uld like to be more generic. I will give me.name a try. I
bet it will work.
I need to read up more on the "me." 's capabilities and uses.

Thanks a bunch.

Scott



All times are GMT +1. The time now is 10:31 AM.

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