Run-time error 424 accessing a table

JenniferMurphy

Well-known Member
Joined
Jul 23, 2011
Messages
2,532
Office Version
  1. 365
Platform
  1. Windows
I found code examples online for accessing various parts of a table using the ListObjects object. I am doing something wrong. The Set TableData statement gets a run-time error 424.

VBA Code:
Sub WtdRtg()

Const rnTable As String = "Tbl"   'The name of the main table
Dim TblData
TblData = Range(rnTable).Value

Dim TableData As ListObject

'Run-time error 424
Set TableData = ActiveSheet.ListObjects(rnTable).Range.Select

Dim TableHdr As ListObject

Set TableHdr = ActiveSheet.ListObjects(rnTable).HeaderRowRange.Select

End Sub
 
Re: Your feedback post.
Wow that a big call 😉 but thank you, I really appreciate the sentiment. 😊
You absolutely deserve it.

Hopefully I can leave it up to you to validate the output but your use of arrays looks fine to me.
The pseudo table in 16:21 is the validator. It does the calculations manually. The numbers in D17:G20 are the individual ZScores. The numbers in C17:C20 are the weighted ratings, which are what the macro is supposed to calculate. As you can see, they are identical! Yea!!

Again, thank you. This code is a million times better than anything I would have come up with on my own and in a fraction of the time.
 
Upvote 0

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Forum statistics

Threads
1,215,042
Messages
6,122,810
Members
449,095
Latest member
m_smith_solihull

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