Possibly a reverse of VLookup???

bradenkeith

New Member
Joined
May 4, 2014
Messages
32
Hey guys,

I need some assistance. I'm trying to formulate a string of code for a reverse of VLookup. I am probably way off, but let me try to explain what it is that I'm trying to accomplish:

Let's say Cell A1 is someones place in line, and Cell B1 needs to be entered with the persons corresponding hat color. Let's say the third person in line has a Blue hat. I would use a scroll wheel to change cell A1 to 3, and update Cell B1 with "Blue."


AB
13Blue

<tbody>
</tbody>

At this point, I would click an "Update" button and a macro would run. The information I entered into cell B1 would be updated into the table I have set up on Spreadsheet3.

Place in LineHat Color
1
2
3Blue
4
5

<tbody>
</tbody>

Then, I could change Cell A1 to 5 and update Cell B1 to Green, because that is that persons hat color. It would update in the table on Spreadsheet3 and so on..:

Place in LineHat Color
1
2
3Blue
4
5Green

<tbody>
</tbody>


This is the non-functioning code i have come up with:

Code:
Sub ReverseVLookup()
    i = Sheets("Sheet1").Range("A1").Value
    Sheets("Sheet3").Range(i, 2).Value = Sheets("Sheet1").Range("B1").Value
End Sub

Please help. Thanks.
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
You'd need to use:
Rich (BB code):
Sheets("Sheet3").Cells(i, 2).Value
assuming you don't have a header row in your table and the table starts in row 1. If you do have a header row, you'd need to add 1 to i. Equally if the table doesn't start in row 1 you'd need to adjust for that as well.
 
Upvote 0
Yup, I've done it. I'm so exhausted that I have become brain-dead. I'm going to sleep now. Thank you for your help. I don't know what I was thinking. And here the whole time I was typing, I didn't even realize it. Too much code... Good night.
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,198
Members
449,072
Latest member
DW Draft

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