How to determine the worksheet that a calculate event gets initiated on when the workbook is not act

R

Riddler

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
 
R

Riddler

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
 
N

NickHK

Scott,
If that achieve your aim, you can be more generic:

Private Sub Worksheet_Calculate()
MsgBox Me.Name
End Sub

NickHK
 
R

Riddler

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top