开发者

How to determine the INTERSECT of a "projection" of row headers and column headers

In an excel spreadsheet, I have reference to a range of Row Headers, and Column Hea开发者_高级运维ders; the data corresponding to these would be the intersection of the "projection" of the two ranges. ie: the ranges themselves don't actually intersect, but projecting them down/to the right would produce the intersection I am interested in. I am looking to determine the range representing the entire intersection of the RowHeaders and ColumnHeaders.

Looks like this:

   c  c  c  c  c 
r  d  d  d  d  d  
r  d  d  d  d  d  
r  d  d  d  d  d  
r  d  d  d  d  d

So, I start with the 2 ranges containing 'rs and c's, I am interested in deriving the range containing d's. There can possible be some empty rows or columns after the row or header (ie: data might not immediately start in the first cell below a column header....there may be several blank rows before the first row header & data begins.

This seemed like it should work, but no such luck:

Intersect(rngRowHeaders.Rows, rngColumnHeaders.Columns).Address


Intersect(rngRowHeaders.EntireRow, rngColumnHeaders.EntireColumn).Address

That should get you what you want.


Try Resize. something like this assuming that rowhdr is a named range referring to the rs and columnhdr is a named range referring to the cs. Works for me

 MsgBox Range("rowhdr").Offset(0, 1).Resize(, Range("columnhdr").Columns.Count).Address
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜