Location of Cell Between Embedded Chart

B

Bill

I have a chart embedded on a worksheet. I would like to select the cell
just below the chart. Is there a way of finding that location?

Thanks,

Bill
 
T

Tim Barlow

Bill,

AFAIK, there is no easy lookup - you have to work it out:

1. Determine the position of the chart and its height on the sheet:

Dim baseline as Double
With ActiveSheet.ChartObjects("Chart 1")
baseline = .Top + .Height
End With

2. Add together the heights of all the rows until the sum is greater than
the baseline above:

Dim aRow As Long
Dim cumRowHt As Double

Do
aRow = aRow + 1
cumRowHt = cumRowHt + Rows(aRow).RowHeight
Loop Until cumRowHt > baseline
Cells(aRow + 1, 2) = "Put text Here"


You can do something similar with the left & width properties to determine
which column.

HTH

Tim
 
P

Peter T

Tim & Bill

I didn't see the OP but simply

Dim rng As Range
With ActiveSheet.ChartObjects(1)
Set rng = ActiveSheet.Cells(.BottomRightCell.Row + 1, _
.TopLeftCell.Column)
End With

rng.Select

Regards,
Peter T
 
T

Tim Barlow

Peter,

That's much neater & quicker.

Tim


Peter T said:
Tim & Bill

I didn't see the OP but simply

Dim rng As Range
With ActiveSheet.ChartObjects(1)
Set rng = ActiveSheet.Cells(.BottomRightCell.Row + 1, _
.TopLeftCell.Column)
End With

rng.Select

Regards,
Peter T
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top