VBA - to Lookup a value in table - Then return all matches

hmltnangel

Active Member
Joined
Aug 25, 2010
Messages
290
Office Version
  1. 365
Platform
  1. Windows
Afternoon all, `

I have had a search but couldnt see anything quite like what I need. I have a nice big table called "ID". In this table there are a list of staff ID numbers in column L. And in Column AS we have the Staff members Line Mangers ID number.

What I would like to do is a bit of VBA, to lookup a value in cell C4 (Free text box where you input a Manager ID number), within the "ID" table. then return the ID number all the staff who have this individual as the Manager. Each Staff member should have their own row. So even just list the Staff IDs in column B from Row 11 downwards

Does that make sense? And is it possible?

Normally I can find a bit of VBA to tailor to my needs, but this one I am stumped.
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Edited the post :censored: I do know what you mean - I hate using them. Is there anyway to get it to skip a row, if I unmerge them?
 
Upvote 0
Do you mean you only want the code to look at every row in the filtered table?
 
Upvote 0
I would like it to take the filtered data, then input it to the new location as it does., but skip a row (ie - leave a blank row) after each value it inputs

I was toying with just recording a macro to copy paste the values and skip a row each time it pastes
 
Upvote 0
In that case try
VBA Code:
      For Each Cl In .ListColumns("EmplId").DataBodyRange.SpecialCells(xlVisible)
         i = i + 1
         Ary(i, 1) = Cl.Value
        i = i + 1
      Next Cl
 
Upvote 0
Solution
Fluff, you are a genius. Thank you :)

I was so close as well, I was trying i=i+2, and also adding an extra i=i+1 - but before the Ary line of code.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,196
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