I have a problem with my application, below:
In my excel I have a sheet called parameters, in it I have two columns, where column A is the name of the parameter and column B is the value of the parameter.
I created a method called BuscarParametro
where I get the parameter name (column A) and should return the value of the parameter (column B).
The method looks in column A for the value it received per parameter, finding it takes the line number and concatenates it with column B to know the value of the parameter.
My doubts would be:
Is there a better and more efficient way to do this?
Find
method, even if there is a value in the worksheet
The following is the method below:
Public Function BuscarParametro(Parametro As String) As String
Dim Resultado As Range
Dim Posicao As String
Set Resultado = Sheets("parametros").Range("A1:A9999").Find(Parametro, _
LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByRows)
If Resultado Is Nothing Then
Exit Function
End If
Posicao = "B" & Resultado.Row
BuscarParametro = Sheets("parametros").Range(Posicao)
End Function