Figuring out where you are in an Excel 2007 range.
December 9th, 2009
Ever tried to debug a loop inside a listObject.Range? Use get_Address(). It makes the process a lot easier.
Code:
private object missing = System.Reflection.Missing.Value;
Range range =
Debug.WriteLine("Range: " + range.get_Address(missing, missing, XlReferenceStyle.xlA1, missing, missing));
Usage:
range.get_Address(missing, missing, XlReferenceStyle.xlA1, missing, missing)
Notes:
The output can be parsed if you want to find something like the first row or column in your range. Don’t forget to use get_Offset() for iterating through the list once you have the row or column. Just a thought…
