Error 91 on ListObject

JuanPa

New Member
Joined
Jun 9, 2010
Messages
32
Hi. I've got a workbook, with a sheet 'tblPrices', which has a listobject named 'Prices'.
I'm having problems with a code that I'be simplified as follows:
Code:
[FONT=Courier New]...
[COLOR=DarkSlateBlue][COLOR=Navy]With[/COLOR] [/COLOR]ThisWorkbook.Worksheets("tblPrices")
    .Activate
    [COLOR=DarkSlateBlue][COLOR=Navy]With[/COLOR] [/COLOR].ListObjects("Prices")
        .Range.Select
        [COLOR=Navy]Debug[/COLOR].[COLOR=Navy]Print [/COLOR].DataBodyRange.Address
    [COLOR=Navy]End With[/COLOR]
[COLOR=Navy]End With[/COLOR]
...[/FONT]
When trying to access the DataBodyRange property, a error message is shown:
Code:
Error 91 Object Variable or With block variable not set
I've intentionally activated the worksheet and selected the listobject just to dismiss any focus issue. I have no idea what's going on here.

Thanks a lot,

JuanPa
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Yes, the point is required since DataBodyRange belongs to .ListObjects("Prices").
It looks really weird because I'd swear I already ran this code and worked. I've already killed Excel and same result.
 
Upvote 0
Just ran the code on other workbook and worked fine. Something's wrong with my file that is affecting the DataBodyRange behavior.
 
Upvote 0

Forum statistics

Threads
1,224,591
Messages
6,179,768
Members
452,940
Latest member
rootytrip

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top