# As many Active Cells as You like.. At once….---o00o---`(_)`---o00o---  ...  OOP "hierarchy" ?????



## DocAElstein (May 26, 2014)

*'Re:   As many Active Cells as You like.. At once….
'*---o00o---`(_)`---o00o---    




*'' An / To :- MrExcel VBA Excel Forum*
*'' Von / From :- Alan Elston*
*'' Hallo,*
''   My first time here.
''   The following might be obvious as I’m new to Excel
''   But I thought it was a bit interesting.
''    It came out of my first question on MrExcel   (  in the 
''    MrExcel Forum „    Excel Questions
''    All Excel/VBA questions“
''   Link :-    http://www.mrexcel.com/forum/excel-...workbooks-windows-oop-method.html#post3818451           )
''   Firstly from Books and experienced VBA Programmers I got the 
''  impression that by using the "dot" ,
'' .     _“you always work down the hierarchy”_
''  Clearly from the answers I got that is not  the case. 
''   The      .Application       Object gives at least one way of
''   going “backwards”   or   "going back up the hierarchy "
''    This is because    .Application    can be called from all over the place, 
''   that is to say at least twice on the same line, which is
''   why I had the problem which led to may first question.
''    ( …….That also explains why it crops up all over the place in the 
''     Excel     library!- A lot of experience VBA users told me they thought 
''    that was because there were lots of them depending on where they were!
''    they were wrong!!??????????...........................)
''     Basically I wanted to access and manipulate the
''  active cell in a lot of open    Workbooks     without having to
''   activte the workbook every time. I thought I could
''   do this with the       Application.ActiveCell
''    but in fact I was always going back up to the
'   .Application         ( in this case the application of     Excel      ). By
'' "going back up", the in-between code I wrote (which gave the
'' impression I was accessing a particular Cell in a particular
'' Workbook) was ignored/ irrelevant.
'' By "going back up" I was then using the "unique" Object
''   .Application
'' The application of Excel has only one Active Cell
'' which is always that of the activated Worksheet of a workbook.
''
''   *But, and this is the point I’m trying to get across,, *
''  you can get around this limitation using the 
''  .Windows( ) object:-
''
''   The .Windows( ) object  has an Active cell property,
''   You can use this to have as
''   many Active cells as there are open Workbooks.
'' These can be for example referenced by name

Let a = Windows("Mappe1").ActiveCell
Let b = Windows("Mappe2").ActiveCell

' or in the order that the Workbooks were opened,

Let a = Windows.Item(1).ActiveCell
Let b = Windows.Item(2).ActiveCell

'' where Item 1 is always the last workbook opened, item 2 the one before, etc.


''That’s it, sorry if I rambled on a bit but it helped me to understand 
''  it all a last time!!
''   Goodbye, Aufwiedersehen
'' Alan Elston
'' Baveria
'' Germany.
''  P.s.   ( Of course I could be talking a lot of rubbish,- I’ve just started
''  with VBA. Feel free to put me right!!)


----------



## CharlesChuckieCharles (May 29, 2014)

There is only one activecell per work book instance


"I’ve just started
'' with VBA. Feel free to put me right"

Your font colour choices need a re-think  light green on grey  is camoflage


----------



## DocAElstein (May 29, 2014)

*Hi   CharlesChuckieCharles*

*“   There is only one activecell per work book instance  “   *
…….Thanks, that helps me to understand. 
         – It makes sense and ties up with what I’ve experienced when I think about it!  ….  
(application.activecell is perhaps a poor word choice – the bloke who wrote or invented VBA should have  called it application.ActivatedWorkbookActiveCell so that it doesn’t get confused with the Windows().ActiveCell which you can have as many as you want, (.. that is to say as many instances?!?)!!

*“   Your font color choices need a re-think light green on grey is camouflage   “*
…..Yeh, a few people have mentioned that already. I’ve got a “thing” with colors.
         – I’ll try and behave myself in future

*Alan El sToN. –oops , sorry*


----------



## shg (May 29, 2014)

> should have called it application.ActivatedWorkbookActiveCell so that it doesn’t get confused with the Windows().ActiveCell


But it's not; it's the active cell in the active window.


----------



## DocAElstein (May 29, 2014)

Hallo shg
.                                                                     ‹(•¿•)›                                                  

..........,,..   But it's not; it's the active cell in the active window...."

 Yeah, thanks, that makes sense as well..

... so  it should the have been called  ActivatedWindowActiveWindow

Thanks

Alan ..


----------



## DocAElstein (May 29, 2014)

... oops....I meant ActivatedWindowActive*Cell*

Alan


----------



## DocAElstein (May 29, 2014)

*....and then perhaps the other ones should be called * Windows().LastActivatedCell

*..... or *  Windows().ActivatedCellWhenitWasLastActivated


*....,,,  Alan*


----------



## DocAElstein (May 30, 2014)

Hello
   There is some new info to this Theme on the German forum just now  ( In English and German!!) in the following link / Thread

http://www.mrexcel.com/forum/questi...durch-workbooks-oder-windows-oop-methode.html


Alan


----------

