Working with the .Parent.Parent feature. This, this example shows how setting only one myRng reference enables dynamic access to the entire environment with nowithout any .Select, .Activate, .Activecell, .ActiveWorkbook, .ActiveSheet and so on. (There's no genereicThere isn't any generic .Child.Child feature.)
Sub ShowParents()
Dim myRng As Range
Set myRng = ActiveCell
Debug.Print myRng.Address ' anAn address of the selected cell
Debug.Print myRng.Parent.name ' theThe name of sheet, where MyRng is in
Debug.Print myRng.Parent.Parent.name ' theThe name of workbook, where MyRng is in
Debug.Print myRng.Parent.Parent.Parent.name ' theThe name of application, where MyRng is in
' You may use this feature to set reference to these objects
Dim mySh As Worksheet
Dim myWbk As Workbook
Dim myApp As Application
Set mySh = myRng.Parent
Set myWbk = myRng.Parent.Parent
Set myApp = myRng.Parent.Parent.Parent
Debug.Print mySh.name, mySh.Cells(10, 1).Value
Debug.Print myWbk.name, myWbk.Sheets.Count
Debug.Print myApp.name, myApp.Workbooks.Count
' You may use dynamically addressing
With myRng
.Copy
' pastesPastes in D1 on sheet 2 in the same workbook, where the copied cell is
.Parent.Parent.Sheets(2).Range("D1").PasteSpecial xlValues
' orOr myWbk.Sheets(2).Range("D1").PasteSpecial xlValues
' weWe may dynamically call active application too
.Parent.Parent.Parent.CutCopyMode = False
' orOr myApp.CutCopyMode = False
End With
End Sub