ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   run macro only in certain file/worksheet (https://www.excelbanter.com/excel-programming/398660-run-macro-only-certain-file-worksheet.html)

huepf

run macro only in certain file/worksheet
 
Hi,

I want to make sure that a macro only runs in one certain file.

I was thinking to get check the file name of the open file and run the
program only if it's the right file. Is there an easier way to do
that?

If not, how do I get the file name of the open and active worksheet?

thanks!


Sam Wilson

run macro only in certain file/worksheet
 
Activesheet.name returns the sheet name, activeworkbook.name the file

"huepf" wrote:

Hi,

I want to make sure that a macro only runs in one certain file.

I was thinking to get check the file name of the open file and run the
program only if it's the right file. Is there an easier way to do
that?

If not, how do I get the file name of the open and active worksheet?

thanks!




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

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