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

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
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,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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