Ranges can be of different types:
When a range object is a row range, then its range.Top and range.Bottom properties are populated to reflect the top and bottom rows of the range but, its range.Left and range.Right are indeterminate at this point.
Similarly, column ranges have range.Left and range.Right defined but, not top and bottom. So, before you can arbitrarily start using the properties of a range, you must check its type to see what properties are valid.
Converting an arbitrary range to cell range
The only range type that has all its properties populated are cells. So, when you are given an arbitrary range, you must make sure that all of its properties are populated by using range.ExpandRange that forces all the properties to be defined.
After running the above codes, the range becomes a Cell Range.
Retrieving selected ranges
To iterate through the arbitrary selected ranges, you must use the Selections.GetSelectedrange in code as follows.
|Article ID:||Published Date:||Last Revised Date:||Platform:||Control:|