Union ranges in Excel Interop
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)
精彩评论