Hello everyone,

I'm having some excel issues. I don't want to have to "specify" a range.

Right now, my range is "A1" to "Z500". This is because I want to autofit my columns and center the text like shown:

Code:
//Center the text in Excel 
                    xlWS.get_Range("A1", "Z500").VerticalAlignment = Excel.XlVAlign.xlVAlignCenter; 
                    xlWS.get_Range("A1", "Z500").HorizontalAlignment = Excel.XlVAlign.xlVAlignCenter; 
 
                    //Autofit the columns in Excel 
                    xlRng = xlWS.get_Range("A1", "Z500"); 
                    xlRng.EntireColumn.AutoFit();


Is there a way to center the text and autofit the entire Excel document, without specifying a certain range?
And is it possible to auto detect a range so that I don't have to set it ahead of time. The Excel document that the user loads up may vary in UsedRange. Is there way to find that out? Sorry for so many questions. Thanks.