Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Is ActiveSheet in ThisWorrkbook?
Is there a way to check if ActiveSheet is part of the workbook in which
the a macro is located? I have a macro which switches between 3 open workbooks, and for some reason the activesheet also switches... How to check if ActiveSheet is in ThisWorkbook or in ActiveWorkbook? Thanks, CE |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Is ActiveSheet in ThisWorrkbook?
The active sheet is always in the active workbook.
-- Jim Cone Portland, Oregon USA . http://www.mediafire.com/PrimitiveSoftware . (List Files XL add-in: finds and lists files/folders with hyperlinks) "Charlotte E." wrote in message ... Is there a way to check if ActiveSheet is part of the workbook in which the a macro is located? I have a macro which switches between 3 open workbooks, and for some reason the activesheet also switches... How to check if ActiveSheet is in ThisWorkbook or in ActiveWorkbook? Thanks, CE |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Is ActiveSheet in ThisWorrkbook?
More...
You do not have to activate a workbook in order to run code. "Workbooks(2).Sheets(3).Range("A1").value2 = 1234" runs just fine without activating/selecting that workbook. If you do have to determine if the workbook with code is active then... "ActiveSheet.Parent Is ThisWorkbook" returns True or False. '--- Jim Cone "Jim Cone" wrote in message ... The active sheet is always in the active workbook. -- Jim Cone Portland, Oregon USA . http://www.mediafire.com/PrimitiveSoftware . (List Files XL add-in: finds and lists files/folders with hyperlinks) "Charlotte E." wrote in message ... Is there a way to check if ActiveSheet is part of the workbook in which the a macro is located? I have a macro which switches between 3 open workbooks, and for some reason the activesheet also switches... How to check if ActiveSheet is in ThisWorkbook or in ActiveWorkbook? Thanks, CE |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Is ActiveSheet in ThisWorrkbook?
Indeed the ActiveSheet is always in the ActiveWorkbook because both are visible on screen.
ThisWorkbook is the workbook within which the macro runs and the ActiveSheet is not necessarily in ThisWorkbook. To check such a fact use an if statement: If ActiveWorkbook.Name=ThisWorkbook.Name then..... See all about these workbooks in my tutorial at www.excel-vba.com Peter |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Is ActiveSheet in ThisWorrkbook?
Indeed the ActiveSheet is always in the ActiveWorkbook because both are visible on screen.
ThisWorkbook is the workbook within which the macro runs and the ActiveSheet is not necessarily in ThisWorkbook. To check such a fact use an if statement: If ActiveWorkbook.Name=ThisWorkbook.Name then..... |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Use a password in VBA ActiveSheet.protect & ActiveSheet.unprotect? | Excel Programming | |||
Copying new activesheet after other activesheet is hidden? | Excel Programming | |||
ActiveSheet | Excel Programming | |||
ActiveSheet | Excel Programming | |||
ActiveSheet | Excel Programming |