Closed Thread
Results 1 to 3 of 3

[SOLVED] range variable won't assign (chartobject.topleftcell property)

  1. #1
    Matthew Dodds
    Guest

    [SOLVED] range variable won't assign (chartobject.topleftcell property)

    Folks,

    This one has me stumped; can an expert ride to the rescue please!!

    In the code below the assignment marked **** doesn't work; rngTopLeft
    remains resolutely NOTHING in the locals window. In an attempt to
    trouble shoot I've added various debug statements to see whether the
    information demanded by the assignment is available, and all print the
    expected info to immediate window.

    Suggestions, please, as to why the assignment to rngTopLeft doesn't
    happen

    Many thanks in anticipation

    Matt


    On Error Resume Next 'currClust not yet assigned, n'oubliez pas
    If Not rngCluster = rngCurrentCluster Then 'change H & V offset
    for charts in new cluster
    If iChart = 1 Then 'chart was the very first chart
    iHoffset = iHoffset + iXsize
    iVoffset = 0
    iChart = iChart + 1
    **** rngTopLeft =
    ActiveSheet.ChartObjects(ActiveSheet.ChartObjects.Count).TopLeftCell

    Debug.Print ActiveSheet.Name: '->SHEET CORRECT
    Debug.Print ActiveSheet.ChartObjects.Count: '->NUMBER CORRECT (1)
    Debug.Print ActiveSheet.ChartObjects
    _(ActiveSheet.ChartObjects.Count).TopLeftCell.Address: '->CORRECT
    ADDRESS
    Debug.Print TypeName(ActiveSheet.ChartObjects
    _(ActiveSheet.ChartObjects.Count).TopLeftCell): '-> it's a range, now
    there's a surprise NOT
    Debug.Print ActiveSheet.ChartObjects
    _(ActiveSheet.ChartObjects.Count).BottomRightCell.Address: '->CORRECT
    ADDRESS


  2. #2
    Chip Pearson
    Guest

    Re: range variable won't assign (chartobject.topleftcell property)

    You need the 'Set' keyword since you are working with an object
    type variable.

    Set rngTopLeft = _
    ActiveSheet.ChartObjects(ActiveSheet.ChartObjects.Count).TopLeftCell--Cordially,Chip PearsonMicrosoft MVP - ExcelPearson Software Consulting, LLCwww.cpearson.com"Matthew Dodds" <[email protected]> wrote in messagenews:[email protected]...> Folks,>> This one has me stumped; can an expert ride to the rescueplease!!>> In the code below the assignment marked **** doesn't work;rngTopLeft> remains resolutely NOTHING in the locals window. In an attemptto> trouble shoot I've added various debug statements to seewhether the> information demanded by the assignment is available, and allprint the> expected info to immediate window.>> Suggestions, please, as to why the assignment to rngTopLeftdoesn't> happen>> Many thanks in anticipation>> Matt>>> On Error Resume Next 'currClust not yet assigned,n'oubliez pas> If Not rngCluster = rngCurrentCluster Then 'change H & Voffset> for charts in new cluster> If iChart = 1 Then 'chart was the very firstchart> iHoffset = iHoffset + iXsize> iVoffset = 0> iChart = iChart + 1> **** rngTopLeft =>ActiveSheet.ChartObjects(ActiveSheet.ChartObjects.Count).TopLeftCell>> Debug.Print ActiveSheet.Name: '->SHEET CORRECT> Debug.Print ActiveSheet.ChartObjects.Count: '->NUMBER CORRECT(1)> Debug.Print ActiveSheet.ChartObjects> _(ActiveSheet.ChartObjects.Count).TopLeftCell.Address:'->CORRECT> ADDRESS> Debug.Print TypeName(ActiveSheet.ChartObjects> _(ActiveSheet.ChartObjects.Count).TopLeftCell): '-> it's arange, now> there's a surprise NOT> Debug.Print ActiveSheet.ChartObjects> _(ActiveSheet.ChartObjects.Count).BottomRightCell.Address:'->CORRECT> ADDRESS>


  3. #3
    Matthew Dodds
    Guest

    Re: range variable won't assign (chartobject.topleftcell property)

    Thanks Chip. And apologies to the group. It was a long day and the tyro
    in me was in the ascendant.


Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1