mercredi 17 novembre 2021

Use the sheet number to check the active sheet

Before some code runs, I want to check it is the correct sheet.

I can use the sheet name, but my concern is that if someone changes the sheet name, the code won't run. The sheet index also seems to change if the sheet is moved.

Therefore I want to use something that doesn't change.

I believe the sheet number and sheet ID never change.

So I was hoping to use one of them, but I can't see a way of doing that.

What I want in non-coding language is:

If active sheet number = 4 then run the code or If active sheet ID = 0123456789 then run code

Aucun commentaire:

Enregistrer un commentaire