Refer to sheet by index RRS feed

  • Question

  • I have set a series of sheets to be dynamically named through some code picking up the name from a cell in the sheet. But now I want to sum some values over the collection of sheets but dont know how to do this as the sheet names are dynamic. If I use the formula =sum(('sheeta:sheetK'!A1) will it collapse as the sheets are renamed. If so should I refer to the sheet index somehow



    Tuesday, June 28, 2011 7:01 PM


  • I hope this helps

          this.Range["a1", missing].Formula = "=" + 
            ((Excel.Worksheet)Globals.ThisWorkbook.Worksheets[1]).Name +
            "!A1" + "+" +
            ((Excel.Worksheet)Globals.ThisWorkbook.Worksheets[2]).Name + 

    Wednesday, June 29, 2011 1:20 AM