VBA Vlookup help

FootBallBat

Board Regular
Joined
Jan 26, 2012
Messages
169
Im looking for a VBA code that works like Vlookup.
Lookup data= A:B
(D1) is a dropdown list of A:A
(E1) is a manual input of a number.
When the Macro is ran, I want it to search for (D1) in column A:A and increase the amount in the corresponding B:B column by the amount in (E1).

[TABLE="class: grid, width: 100, align: center"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[/TR]
[TR]
[TD]Bronze[/TD]
[TD]12[/TD]
[TD][/TD]
[TD]Gold[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]Silver[/TD]
[TD]6[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Gold[/TD]
[TD]10[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Platinum[/TD]
[TD]4[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Hi
What about
Code:
Sub TEST()
    With Range("A1:B4")
        For Each C In Range("A1:A4")
            If C = Range("d1") Then
                C.Offset(, 1) = C.Offset(, 1) + Range("e1").Value
            End If
        Next C
    End With
End Sub
 
Last edited:
Upvote 0
You are very well come and thank you for the feedback
Be happy
 
Upvote 0
Code:
Sub TEST()
        For Each C In [A1:B4]
            If C = [D1] Then
                C.Offset(, 1) = C.Offset(, 1) + [E1].Value
            End If
        Next C
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top