ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Capturing BottomRightCell in a Variable (https://www.excelbanter.com/excel-programming/446622-capturing-bottomrightcell-variable.html)

[email protected]

Capturing BottomRightCell in a Variable
 
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.Add ress

Seems pretty straightforward, but it won't work.

Thanks!

Auric__

Capturing BottomRightCell in a Variable
 
usr58201 wrote:

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.Add ress

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.Add ress

--
I expect wisdom from you. The least you can do is pretend you are wise.


All times are GMT +1. The time now is 08:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com