3
I have a problem with my application, follow:
In my excel I have a sheet called parameters, on it I have two columns, where column A is the parameter name and column B is the parameter value.
I created a method called BuscarParametro
where I receive the parameter name (column A) and return the parameter value (column B).
The method looks for in column A the value it received per parameter, finding it takes the number of the row and concatenates with column B to know the value of the parameter.
My doubts would be:
There’s a better and more efficient way to do this?
In the method code, returns nothing in the method
Find
, even if there is value in the spreadsheet
Below is the method:
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
Great! It worked, thank you dot.Py!!
– bbariotti
@bbariotti, good! Since this answer solved your problem, I suggest that accepted the answer to mark it as answered.
– dot.Py
Done @dot. Py !!! Taking advantage, if possible, could help me with this other doubt: https://answall.com/questions/208915/consultar-dados-com-filtro-vba
– bbariotti