Free Support Forum -

Worksheet Index Property #2

I have posted this message as a reply to a previous thread but wanted to ensure that it is read so I am posting again as a new posting. Sorry for the duplicate entry.

I have found another problem with the Worksheet Index Property. The Index is not properly updated when a worksheet is removed from the collection using the RemoveAt method.

Initial Index
ReportA = 1
ReportB = 2
ReportC = 3

Expected Index Results after removing worksheet "ReportB"
ReportA = 1
ReportC = 2

Actual Indexes Results:
ReportA = 1
ReportC = 3

The following Code will demonstrate the problem:

Dim intIndex1 As Int16 = _WorkBook.Worksheets(“ReportC”).Index


Dim intIndex2 As Int16 = _WorkBook.Worksheets(“ReportC”).Index

Again, this causes unexpected results within my application because I am using the index property of a worksheet to manipulate the workbook.

Thank you in advance for your help.

Thanks for your report. I fixed it. Please try the attached fix.

Thanks again for your amazing support.