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

DocAElstein

Banned user
Joined
May 24, 2014
Messages
1,336
'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!!)
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
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
 
Upvote 0
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
 
Upvote 0
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.
 
Upvote 0
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 .
.
 
Upvote 0
....and then perhaps the other ones should be called Windows().LastActivatedCell

..... or Windows().ActivatedCellWhenitWasLastActivated


....,,, Alan
 
Upvote 0

Forum statistics

Threads
1,217,908
Messages
6,139,332
Members
450,194
Latest member
AmateurHour

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top