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

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
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,216,099
Messages
6,128,823
Members
449,470
Latest member
Subhash Chand

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