Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ronaldo wrote:
Hi, At least do I belive I should use arrays to solve it, but did sleep during the array part of the course:-) In an Worksheet_Deactivate event, I want to compare if the Target range is into one of my known sheets or if it is an unknown sheet. This will make me know if Target is another workbook, since there will be no more sheets in my workbook. I thought of running a loop through my array with 13 woorksheets and see if the "ActiveWorksheet" is there. I have started to give name the arrays like: shtArray(0) = Sheet1.Name shtArray(1) = Sheet2.Name : and thought of running a Loop like: "If ActiveSheet.Name < shtArray" Then I has been thinking about using woorkbook_deactivate event, but can't find out how i can get the Target range and continue with my code in a right way. Better ways to solve it are of course welcome, but maybe this give me a reason to learn arrays once and for all:-) - Regards - You might want to consider adding a reference to Microsoft Scripting Runtime and using something like Sub qwerty1() Dim x As Dictionary, i As Long Set x = New Dictionary For i = 1 To Worksheets.Count x.Add Item:=Worksheets(i).Name, key:=CStr(Worksheets(i).Name) Next If x.Exists("Sheet3") Then 'Do whatever Else 'Do whatever else End If End Sub Alan Beban |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Using COUNTA for a variable array | Excel Worksheet Functions | |||
use a variable array in a formula | Excel Discussion (Misc queries) | |||
about ARRAY variable | Excel Programming | |||
Variable Array Problem | Excel Programming | |||
Problem trying to us a range variable as an array variable | Excel Programming |