Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default VisibleRange references

Hi,
Is there a way to reference ActiveWindow.VisibleRange functions while an
embedded chart is selected?

Thanks much
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default VisibleRange references

In general, for a chart, you need the Parent of the parent of the parent

Dim myS As Worksheet
Set myS = Selection.Parent.Parent.Parent
msgbox myS.name & " is the active sheet."


More or fewer .Parent my be needed, depending on what the actual selection is.

Or you could try them all until you don't get an error:

Dim myS As Worksheet

On Error GoTo NotSheet1
Set myS = Selection.Parent.Parent.Parent.Parent
GoTo AllOK

SheetTry2:
On Error GoTo NotSheet2
Set myS = Selection.Parent.Parent.Parent
GoTo AllOK

SheetTry3:
On Error GoTo NotSheet3
Set myS = Selection.Parent.Parent
GoTo AllOK

SheetTry4:
On Error GoTo NotSheet4
Set myS = Selection.Parent

AllOK: MsgBox myS.Name & " is the active sheet."
Exit Sub
NotSheet1:
Resume SheetTry2
NotSheet2:
Resume SheetTry3
NotSheet3:
Resume SheetTry4
NotSheet4:
MsgBox "Not sure what that selection is..."



HTH,
Bernie
MS Excel MVP


"RLang" wrote in message
...
Hi,
Is there a way to reference ActiveWindow.VisibleRange functions while an
embedded chart is selected?

Thanks much



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default VisibleRange references

Hi Bernie,
Thanks for the response. I hadn't used the Parent object before and I
get the logic to navigate to the original worksheet name but I'm still unsure
what the followup command is to call the "VisibleRange" functions to
determine what portion of the spreadsheet and embedded chart is visible to
the user without deselecting the chart and selecting the spreadsheet itself
to call the command. I want to be able to do this without de-selecting the
chart series. The only way so far that I can see to use the VisibleRange
functions is through the ActiveWindow object and this errors out whenever any
part of the chart is selected.

"Bernie Deitrick" wrote:

In general, for a chart, you need the Parent of the parent of the parent

Dim myS As Worksheet
Set myS = Selection.Parent.Parent.Parent
msgbox myS.name & " is the active sheet."


More or fewer .Parent my be needed, depending on what the actual selection is.

Or you could try them all until you don't get an error:

Dim myS As Worksheet

On Error GoTo NotSheet1
Set myS = Selection.Parent.Parent.Parent.Parent
GoTo AllOK

SheetTry2:
On Error GoTo NotSheet2
Set myS = Selection.Parent.Parent.Parent
GoTo AllOK

SheetTry3:
On Error GoTo NotSheet3
Set myS = Selection.Parent.Parent
GoTo AllOK

SheetTry4:
On Error GoTo NotSheet4
Set myS = Selection.Parent

AllOK: MsgBox myS.Name & " is the active sheet."
Exit Sub
NotSheet1:
Resume SheetTry2
NotSheet2:
Resume SheetTry3
NotSheet3:
Resume SheetTry4
NotSheet4:
MsgBox "Not sure what that selection is..."



HTH,
Bernie
MS Excel MVP


"RLang" wrote in message
...
Hi,
Is there a way to reference ActiveWindow.VisibleRange functions while an
embedded chart is selected?

Thanks much




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to convert all 3d references to normal references in a workboo Dima Excel Discussion (Misc queries) 6 August 8th 08 12:38 PM
Help with converting a block of cells with Absolute and mixed references to relative references Vulcan Excel Worksheet Functions 3 December 13th 07 11:43 PM
How unselect? Want to run ActiveWindow.VisibleRange but have Chartobject selected tskogstrom Excel Programming 3 September 30th 06 12:56 AM
How to rename references from range names to cell references Abbas Excel Discussion (Misc queries) 1 May 24th 06 06:18 PM
ActiveWindow.VisibleRange.Width - Is this the correct code StevenS Excel Programming 1 October 15th 05 06:34 AM


All times are GMT +1. The time now is 10:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"