Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 331
Default Excel 2007 table named range does not include headers

with excel 2003, I used to import tables, and then use the imported query
'range name' to do further analysis of the data using (dsum, dcount, ...)

eg.

result =
Application.WorksheetFunction.DCount(Range("sheet1 !query_range_name"), "age",
Range("sheet2!criteria_range_name"))

with excel 2007, the data can now only be imported as a 'table', and the
table 'range name' does not include it's headers, so the above code fails

Have also tried using the 'External Data Properties name' (which is the
range name that used to work in 2003) but this is not recognised either.

I know a possible work around is to create a new range name which includes
the headers and change it each time the table refreshes - but surely there
must be a method without this annoying workaround??
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 331
Default Excel 2007 table named range does not include headers

I solved it myself... when refering to the table as a named range use:

"sheet1!table_name[#All]"

this will include headers in the range.

can also refer to just columns of the table - refer this link:
http://www.jkp-ads.com/Articles/Excel2007TablesVBA.asp


"greg" wrote:

with excel 2003, I used to import tables, and then use the imported query
'range name' to do further analysis of the data using (dsum, dcount, ...)

eg.

result =
Application.WorksheetFunction.DCount(Range("sheet1 !query_range_name"), "age",
Range("sheet2!criteria_range_name"))

with excel 2007, the data can now only be imported as a 'table', and the
table 'range name' does not include it's headers, so the above code fails

Have also tried using the 'External Data Properties name' (which is the
range name that used to work in 2003) but this is not recognised either.

I know a possible work around is to create a new range name which includes
the headers and change it each time the table refreshes - but surely there
must be a method without this annoying workaround??

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Headers/Footers from a named range of cells in a worksheet RMort Excel Discussion (Misc queries) 3 September 19th 08 08:35 PM
Create Named Ranges (Headers) - then using range name in formula ManhattanRebel Excel Programming 12 August 2nd 08 04:09 AM
Include sheetname dynamically in named range? Dallman Ross Excel Discussion (Misc queries) 2 March 18th 08 01:49 PM
Named range reference in VBA for Excel 2007 Mike[_121_] Excel Programming 1 September 12th 07 09:33 PM
Excel will not include all of my non-adj ranges in a named range?? Renlimanit Excel Worksheet Functions 3 September 22nd 05 02:34 PM


All times are GMT +1. The time now is 06:04 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"