Hi all,
I'm trying to perform an vlookup funciont via macro but I'm not very good at vba
I have a workbook with 2 sheets, I need that my macro calculates an vlookup of each cell of column E (beginning with e2), until it finds a blank cell in column E
Then I need that the calculated values by the vlookup get pasted in column K, beginning with K2 (each of them corresponding with e2-k2, e3-k3, etc)
Then I need the macro to multiply the values of col g * values of col K, beginnign both in row 2, and then paste them in col L, beginning with l2.
I tried this just for the lookup, but I get failures and the macro doesnt even run
Sub Vertical_lookup_test()
Dim Result As Variant
Dim myVal As String ' Can be Integer, long, double etc.
Dim Rng As Range
Dim Clm As Integer
Rng = Sheets("cambioTC").Range("a24:a100000") ' Set Range
myVal = Sheets("DeltaFX").Range("e2:e100000") ' Value to be searched
Clm = 4 ' Column to be fetched
Result = Application.VLookup(myVal, Rng, Clm, False)
If IsError(Result) Then
Result = ""
End If
'MsgBox Result
End Sub
Could you please help me??
Thank you very much
I'm trying to perform an vlookup funciont via macro but I'm not very good at vba
I have a workbook with 2 sheets, I need that my macro calculates an vlookup of each cell of column E (beginning with e2), until it finds a blank cell in column E
Then I need that the calculated values by the vlookup get pasted in column K, beginning with K2 (each of them corresponding with e2-k2, e3-k3, etc)
Then I need the macro to multiply the values of col g * values of col K, beginnign both in row 2, and then paste them in col L, beginning with l2.
I tried this just for the lookup, but I get failures and the macro doesnt even run
Sub Vertical_lookup_test()
Dim Result As Variant
Dim myVal As String ' Can be Integer, long, double etc.
Dim Rng As Range
Dim Clm As Integer
Rng = Sheets("cambioTC").Range("a24:a100000") ' Set Range
myVal = Sheets("DeltaFX").Range("e2:e100000") ' Value to be searched
Clm = 4 ' Column to be fetched
Result = Application.VLookup(myVal, Rng, Clm, False)
If IsError(Result) Then
Result = ""
End If
'MsgBox Result
End Sub
Could you please help me??
Thank you very much