quiero buscar un texto en un rango en excel, pero me manda error, alguien me puede ayudar por fa, estoy trabajando en en vb.net 2013 y excel
Imports Microsoft.Office.Interop.Excel
Public Class Nivelacion
Dim excel As New Microsoft.Office.Interop.Excel.Application
Private Sub DemoFind()
Dim currentFind As Excel.Range = Nothing
Dim firstFind As Excel.Range = Nothing
' You should specify all these parameters every time you call this method,
' since they can be overridden in the user interface.
currentFind = Me.Fruits.Find("apples", , _
Excel.XlFindLookIn.xlValues, Excel.XlLookAt.xlPart, _
Excel.XlSearchOrder.xlByRows, Excel.XlSearchDirection.xlNext, False)
While Not currentFind Is Nothing
' Keep track of the first range you find.
If firstFind Is Nothing Then
firstFind = currentFind
' If you didn't move to a new range, you are done.
ElseIf currentFind.Address = firstFind.Address Then
Exit While
End If
With currentFind.Font
.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Red)
.Bold = True
End With
currentFind = Me.Fruits.FindNext(currentFind)
End While
End Sub
End Class