I am using Excel._Worksheet.UsedRange.Rows.Count property to get a count of populated rows. This worked up until I added protect worksheet. Now, my UsedRange returns a value equal to the length of the unlocked cells per column (100) instead of the number of populated cells per column (54). UsedRange returned 54 before I protected the sheet.
Now I get
NullReferenceException when I call ToString()
string columnValue = worksheet.Range[currentColumnString, currentColumnString].Value2.ToString();//currentColumnString = A55, Value2=null
This is because UsedRange.Rows.Count is wrong. How can I get row counts with a protected sheet?