Articles in this section
Category / Section

What is the way to locate cells that contain formula/links/strings/Number using XLSIO?

1 min read

XlsIO has the following API''s to locate the cells that contain the formula, links,strings and Number.

  • HasFormula: Returns the cell that contains formula.
  • HasStyle: Returns the cell that contains Hyperlink.
  • HasString: Returns the cell that has the string value.
  • HasNumber: Returns the cell that has the numeric value.

C#

for (int i = 0; i < sheet.UsedRange.Rows.Length; i++)
{
 for (int j = 0; j < sheet.UsedRange.Columns.Length; j++)
 {
  IRange cell = sheet.Range[i + 1, j + 1];
  if (cell.HasFormula == true)
  {
   MessageBox.Show(cell.AddressLocal + "" + cell.Formula.ToString());
  }
 }
}

 

VB

For i As Integer = 0 To sheet.UsedRange.Rows.Length - 1
 For j As Integer = 0 To sheet.UsedRange.Columns.Length - 1
            Dim cell As IRange = sheet.Range(i + 1, j + 1)
                      If cell.HasFormula = True Then
                         MessageBox.Show(cell.AddressLocal + cell.Formula.ToString())
                     End If
 Next j
Next i

 

Here is the sample for your reference:

Access_Cell_Range.zip

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied