Capturing BottomRightCell in a Variable

U

usr58201

Anyone see what is wrong with this code. I'm getting an 'object required' error:

Dim r As Range
Set r = Sheet2.ChartObjects("myChart").BottomRightCell.Address

Seems pretty straightforward, but it won't work.

Thanks!
 
A

Auric__

usr58201 said:
Anyone see what is wrong with this code. I'm getting an 'object
required' error:

Dim r As Range
Set r = Sheet2.ChartObjects("myChart").BottomRightCell.Address

Seems pretty straightforward, but it won't work.

..Address is a string, not a range (or any other type of object that requires
"Set"). Either do this:
Dim r As Range
Set r = Sheet2.ChartObjects("myChart").BottomRightCell

....or this:
Dim r As String
r = Sheet2.ChartObjects("myChart").BottomRightCell.Address
 

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