开发者

Union ranges in Excel Interop

开发者 https://www.devze.com 2023-02-04 22:09 出处:网络
I want a combined Ranges. How do I combine two ranges into one? Dim range1 as Excel.Range =osheetTemperatureData.Range(\"A7:\"开发者_运维技巧A10\")

I want a combined Ranges. How do I combine two ranges into one?

Dim range1 as Excel.Range =   osheetTemperatureData.Range("A7:"开发者_运维技巧A10")
Dim range2 as Excel.Range =   osheetTemperatureData.Range("C7:"C10")

Dim range3 as Excel.Range = range1 + range2 '????


See this Microsoft KB article: 15: How to Select the Union of Two or More Specified Ranges

You need to use the Excel.Application object and then do something like:

Dim range3 as Excel.Range = xlApp.Union(range1, range2)
0

精彩评论

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