View contents of table cell via VB

UK Excel

New Member
Joined
Aug 26, 2013
Messages
11
Office Version
  1. 365
Platform
  1. MacOS
Hi,
I know this might sound like s stupid question, but how do I view the contents of a single cell of a table when I know the table name, the column heading and the row number.
I have searched and searched Google and found all sorts of VB table related stuff but nothing to help me.

I have a sheet called Formats containing a table called Formats, I have several columns but the header of the column I am interested in is called ShortName

I want to put the value into my variable shortName from the Google searches i have got as far as

shortName = Worksheets("Formats").Range("Formats[ShortName]")

This looks like it refers to the whole column. How do I change this so it refers to a single cell, let's say cell 10.

I found ways using ListObject and DataBodyRange but they seem long winded. The way above looks more readable.

Thanks
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
This looks like it refers to the whole column. How do I change this so it refers to a single cell, let's say cell 10.

If you want the 10th row of the table you could try:

Rich (BB code):
shortName = Worksheets("Formats").Range("Formats[ShortName]").Cells(10).Value
 
Upvote 0
If you want the 10th row of the table you could try:

Rich (BB code):
shortName = Worksheets("Formats").Range("Formats[ShortName]").Cells(10).Value

Thank you very much. That works :)
 
Upvote 0

Forum statistics

Threads
1,215,378
Messages
6,124,603
Members
449,174
Latest member
ExcelfromGermany

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