clarence teo
New Member
- Joined
- Jul 2, 2012
- Messages
- 16
Hi,
I am new to vba here. WIll really appreciate some help with my code.
Here's what I'm trying to do:
1. I created array(i,j) to input a certain set of values2. I created another array(k,l) to input another set of values belonging to
another sheet.<o></o>
3. I want to compare array(I,j) to array(k,l), and input a set of values
next to array(K,L) using vlookup below array(i,j)
4. I’ve tried to use looping to run through both sets of arrays
However, Ive encountered some errors. Here's my code:
Sub ManagementFees()
Dim i As Integer
Dim j As Variant
Dim k As Integer
Dim l As Integer
i = 1
j = 20
k = 10
l = 1
ReDim arr(i, j) As Integer
arr = Range("m24:AG24").Value
ReDim arr1(k, l) As Integer
arr1 = Sheets("Management fees").Select.Range("d3:d13").Value
For Each j In arr
If j.Value > arr1(k, l).Value Then arr(i, j) = VLookup(arr1(k, l).Value, Range("D3:f13"), 3)
k = k + 1
j = j + 1
End If
Next j
End Sub
Thank you.
I am new to vba here. WIll really appreciate some help with my code.
Here's what I'm trying to do:
1. I created array(i,j) to input a certain set of values2. I created another array(k,l) to input another set of values belonging to
another sheet.<o></o>
3. I want to compare array(I,j) to array(k,l), and input a set of values
next to array(K,L) using vlookup below array(i,j)
4. I’ve tried to use looping to run through both sets of arrays
However, Ive encountered some errors. Here's my code:
Sub ManagementFees()
Dim i As Integer
Dim j As Variant
Dim k As Integer
Dim l As Integer
i = 1
j = 20
k = 10
l = 1
ReDim arr(i, j) As Integer
arr = Range("m24:AG24").Value
ReDim arr1(k, l) As Integer
arr1 = Sheets("Management fees").Select.Range("d3:d13").Value
For Each j In arr
If j.Value > arr1(k, l).Value Then arr(i, j) = VLookup(arr1(k, l).Value, Range("D3:f13"), 3)
k = k + 1
j = j + 1
End If
Next j
End Sub
Thank you.