Hi, am having trouble looking up info, but particularly making a list that looks different from the list I extract infofrom. I have tried VLOOKUP with no success, but am working on using .find andoffset, but am having trouble making a list without leaving blank rows.<o></o>
<o> </o>
What I have so far:<o></o>
Private Sub Worksheet_SelectionChange(ByValTarget As Range)<o></o>
<o> </o>
Dim cRNG As Range<o></o>
Set cRNG =Worksheets(2).Range("C:C")<o></o>
With cRNG<o></o>
Call Lookup(Target)<o></o>
End With<o></o>
End Sub<o></o>
<o> </o>
THEN<o></o>
Sub Lookup(Target As Range)<o></o>
Dim pFind As Range<o></o>
<o> </o>
Set pFind =Sheets(1).Range("A:Z").Find(What:=Target.Value, LookIn:=xlValues,LookAt:=xlPart).Offset(, -1).Resize(1, 3)<o></o>
Target.Offset(, -1).Resize(1, 3).Value =pFind.Value<o></o>
End Sub<o></o>
<o> </o>
What I am trying to do is lookup up a value (such as "Q1010") on aworksheet(1) and when found, put the values from its left and right cells on alist in another sheet(2) in a different order.
So (sorry about formatting) it looks something like this:
worksheet(1)
……………..A……………..B………………….C……………………D…………………………E<o></o>
ROW<o></o>
1………..name1……….add1………….Q1010…………..phone1……………otherinfo1
2………..name2……….add2………….Q1011…………..phone2…………… otherinfo2
3………..name3……….add3………….Q1012…………..phone3…………… otherinfo3
4………..name4……….add4………….Q1013…………..phone4…………… otherinfo4
Then, the user can search for Q1010...then Q1013...so on, and have the searchedfor values make a list on sheet(2) but copy over other values from the same row:
worksheet(2)
……………..A……………..B………………….C……………………D…………………………E<o></o>
ROW<o></o>
1…………add1……….Q1010……..otherinfo1………..name1
2…………add4……….Q1013……..otherinfo4………..name4<o></o>
---------------------------------------------
Another feature I have not gotten to yet, but would appreciate help with, is howthe user enters the search value "Q1010." I was thinking of 3 different ways:
1. Use check boxes next to every row, and when the value is found by scrolling throughdata, the user puts a check and that triggers the macro to put "Q1010"cell and the cells to its left and right on the list.
2. click on the cell with containing the desired value, "Q1010," and thattriggers the macro
3. enter the desired value, "Q1010" into a box, userform, cell, whatever.
All three options for user choice of how to search would be ideal.<o></o>
<o> </o>
What I have so far:<o></o>
Private Sub Worksheet_SelectionChange(ByValTarget As Range)<o></o>
<o> </o>
Dim cRNG As Range<o></o>
Set cRNG =Worksheets(2).Range("C:C")<o></o>
With cRNG<o></o>
Call Lookup(Target)<o></o>
End With<o></o>
End Sub<o></o>
<o> </o>
THEN<o></o>
Sub Lookup(Target As Range)<o></o>
Dim pFind As Range<o></o>
<o> </o>
Set pFind =Sheets(1).Range("A:Z").Find(What:=Target.Value, LookIn:=xlValues,LookAt:=xlPart).Offset(, -1).Resize(1, 3)<o></o>
Target.Offset(, -1).Resize(1, 3).Value =pFind.Value<o></o>
End Sub<o></o>
<o> </o>
What I am trying to do is lookup up a value (such as "Q1010") on aworksheet(1) and when found, put the values from its left and right cells on alist in another sheet(2) in a different order.
So (sorry about formatting) it looks something like this:
worksheet(1)
……………..A……………..B………………….C……………………D…………………………E<o></o>
ROW<o></o>
1………..name1……….add1………….Q1010…………..phone1……………otherinfo1
2………..name2……….add2………….Q1011…………..phone2…………… otherinfo2
3………..name3……….add3………….Q1012…………..phone3…………… otherinfo3
4………..name4……….add4………….Q1013…………..phone4…………… otherinfo4
Then, the user can search for Q1010...then Q1013...so on, and have the searchedfor values make a list on sheet(2) but copy over other values from the same row:
worksheet(2)
……………..A……………..B………………….C……………………D…………………………E<o></o>
ROW<o></o>
1…………add1……….Q1010……..otherinfo1………..name1
2…………add4……….Q1013……..otherinfo4………..name4<o></o>
---------------------------------------------
Another feature I have not gotten to yet, but would appreciate help with, is howthe user enters the search value "Q1010." I was thinking of 3 different ways:
1. Use check boxes next to every row, and when the value is found by scrolling throughdata, the user puts a check and that triggers the macro to put "Q1010"cell and the cells to its left and right on the list.
2. click on the cell with containing the desired value, "Q1010," and thattriggers the macro
3. enter the desired value, "Q1010" into a box, userform, cell, whatever.
All three options for user choice of how to search would be ideal.<o></o>
Last edited: