0% found this document useful (0 votes)
271 views1 page

Refer To Excel Cell in Table by Header Name and Row Number: 7 Answers

Uploaded by

vaskore
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
271 views1 page

Refer To Excel Cell in Table by Header Name and Row Number: 7 Answers

Uploaded by

vaskore
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 1

1

Products Search… 1 1

Home
Refer to Excel cell in Table by header name and row number Ask Question

PUBLIC Asked 7 years, 7 months ago Active 5 months ago Viewed 90k times

Questions
I'm trying to refer to a cell in an excel table by using the table header name and the row number
Tags The Overflow Blog
using VBA.
Users 27 How often do people actually copy and
How can I do this? paste from Stack Overflow? Now we
FIND A JOB
know.
Jobs
Podcast 331: One in four visitors to Stack
Companies 15 Overflow copies code

TEAMS Featured on Meta

Stack Overflow for Stack Overflow for Teams is now free for
Teams – Collaborate up to 50 users, forever
and share knowledge
with a private group. excel vba Downvotes Survey results

Outdated Answers: results from use-case


Share Edit Follow survey
edited Jun 5 '20 at 19:00 asked Sep 15 '13 at 10:40
iliketocode Ole Henrik Skogstrøm
6,622 4 41 55 5,644 10 53 79 Hot Meta Posts

77 Let's go off-[script]!
Add a comment
Create a free Team 5 Why was this answer to “numpy-like-
package-for-node” deleted?
What is Teams? 7 Answers Active Oldest Votes

In your example, something like this: Love this site?

44 Dim tb As ListObject Get the weekly newsletter! In it, you'll get:


'assumes Table is the first one on the ActiveSheet
The week's top questions and answers
Set tb = ActiveSheet.ListObjects(1)
MsgBox tb.DataBodyRange.Cells(2, tb.ListColumns("header4").Index) Important community announcements
Questions that need answers

Share Edit Follow answered Sep 15 '13 at 11:56 Sign up for the digest
brettdj
52.6k 15 109 170 see an example newsletter

5 You can also refer to the table name like so: ActiveSheet.ListObjects("Table1") – Ole Henrik Skogstrøm
Sep 18 '13 at 9:44 Linked
Also refer as Range("TableName").ListObject – Ricardo Diaz Mar 19 at 2:47 1 Refer to Excel cell in filtered Table

Add a comment 0 vb excel table vsto loop

A shorter answer is: Related

1989 How do I create an Excel (.XLS and .XLSX)


15 MsgBox [MyTable].Cells(2, [MyTable[MyColumn]].Column) file in C# without installing Microsoft Office?

766 How do I properly clean up Excel interop


Much cleaner and easier! objects?

494 How to convert a column number (e.g. 127)


Share Edit Follow answered May 22 '15 at 14:24 into an Excel column (e.g. AA)

All4Peace 225 Return empty cell from formula in Excel


159 1 5
96 Get content of a cell given the row and
This -> [MyTable[MyColumn]] is what I was looking for :) – Florian Gee Nov 16 '20 at 13:34 column numbers

75 Excel column number from column name


Add a comment
564 How to avoid using Select in Excel VBA

Is there any reason one should avoid using this method? 647 How to use Regular Expressions (Regex)
in Microsoft Excel both in-cell and loops
7 ThisWorkbook.Worksheets("MyWksht").Range("TableName[ColumnTitle]").Cells(RowNumber)
1 Refer to Excel cell in filtered Table
Seems the simplest answer in my opinion.
Hot Network Questions
Share Edit Follow edited Sep 5 '18 at 18:19 answered Sep 5 '18 at 14:43
How can one wish someone a "good night" when
Mike Lasch they sleep during the day?
91 1 6
Misguided use of offensive figures in student
Add a comment presentations

Can any liquid food be beaten into a mousse?

It seems to me that @Salam Morcos solution will not give a proper answer. If table starts from cell How does a GPS antenna have only two
A2 statment [MyTable[FirstColumnName]].Column would give value of 2. Proper solution would connections yet have all this circuitry inside?

5 be: Insufficient material draw on lichess.org

You are kinda Replacable to Me


MsgBox [MyTable].Cells(2, [MyTable].Column-[MyTable[MyColumn]].Column + 1) Could someone help me identify what this piece of
film might be used for

Close neighbours stick together


Share Edit Follow answered Jan 11 '18 at 10:58
TomJohnRiddle Why do some electromagnetic waves continue
747 6 17 travelling while others disappear?

Add a comment Implement an Over function

Offering students a job

It is as simple as this. If you call by the name of the column, then the column index will be 1 for that What happens if a character takes the Thief of
Five Fates invocation, but doesn't have Warlock
range so: spell slots?
0 How do you reliably blow up a rocket that was built
msgbox ActiveSheet.ListObjects(1).ListColumns("header4").DataBodyRange(2,1).value not to explode?

Connect two close parallel train tracks in factorio?

Share Edit Follow What counts as "Java software experience" after


answered Aug 19 '20 at 6:09
all?
Ibo
3,311 6 33 51 Feasibility of super-fast airlock using Utility Fog

Add a comment Why does mass limit acceleration?

Why does trying to break into the NT 3.1 kernel


reboot my 486DX4 machine?
Much simpler, and dynamic:
No More Jockeys - CodeGolf Version

0 ThisWorkbook.Worksheets("WorkSheet_Name").Range("Table_Name").Rows(Table_row_number).SelectDisabling Access to Google Chrome Saved


Passwords in a Secure Way

How do I create binary file with certain value?

Share Edit Follow edited Oct 7 '20 at 17:29 answered Oct 7 '20 at 17:27 Do the end caps on this fuse get transferred to the
new fuse when/if it blows?
Robert Columbia Julien Prévost Franco
6,004 14 28 36 1 What is the longest word without a vowel in any
language?
Add a comment
A Snake Game in C

If you want to write it short: Question feed

-1 [MyTable[header4]].Rows(2)

Share Edit Follow edited Nov 13 '20 at 11:35 answered Nov 13 '20 at 11:27
Suraj Rao Tom
28k 10 85 94 1

Add a comment

Your Answer

Links Images Styling/Headers Lists Blockquotes Code HTML Tables Advanced help

Post Your Answer

Not the answer you're looking for? Browse other questions tagged excel vba or ask your own
question.

STACK OVERFLOW PRODUCTS COMPANY STACK EXCHANGE Blog Facebook Twitter LinkedIn Instagram
NETWORK
Questions Teams About
Technology
Jobs Talent Press
Life / Arts
Developer Jobs Directory Advertising Work Here
Culture / Recreation
Salary Calculator Enterprise Legal
Science
Help Privacy Policy
Other
Mobile Terms of Service
Disable Responsiveness Contact Us
Cookie Settings
site design / logo © 2021 Stack Exchange Inc; user contributions
Cookie Policy licensed under cc by-sa. rev 2021.4.20.39115

You might also like