Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Wed Aug 28, 2024 4:46 pm

How to use FindString Function

Code-
Dim searchRange As CellRange = csrSh.Range("BZ1:SI3")

Dim cellFound As CellRange = searchRange.FindString(benefit, True, True)

benefit is string

The benefit it not present in Excel sheet even though it gives value for cellFound expected result is "Nothing" for particular benefit.

Please give us proper example for expected result.

Saloni_08
 
Posts: 1
Joined: Wed Aug 28, 2024 4:29 pm

Thu Aug 29, 2024 6:26 am

Hello,

Thank you for your inquiry.
Sorry, I'm not entirely sure about your expected effect. You can find them and add some settings just like my test code and my input/output Excel document. If this is not what you expected, you can provide your test input document and the desired result effect, so that we can investigate more accurately.
Code: Select all
Dim workbook As New Workbook()
         workbook.LoadFromFile("in.xlsx")
         Dim worksheet As Worksheet = workbook.Worksheets(0)

         'Get a specific range of cells
         Dim searchRange As CellRange = worksheet.Range("A1:E19")

         'Find cell with specific values within a range of cells
         Dim cellFound As CellRange = searchRange.FindString("40", True, True)

         'Replace the value of a cell with another value
         cellFound.Text = "find"
         'Set the background color of cells
         cellFound.Style.Color = Color.Yellow

         'save file
         workbook.SaveToFile("out.xlsx", ExcelVersion.Version2016)
         workbook.Dispose()

Sincerely,
Amin
E-iceblue support team
Attachments
findString.zip
(14.47 KiB) Downloaded 82 times
User avatar

Amin.Gan
 
Posts: 164
Joined: Mon Jul 15, 2024 5:40 am

Return to Spire.XLS

cron