ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro to include contents of cell (https://www.excelbanter.com/excel-discussion-misc-queries/55443-macro-include-contents-cell.html)

Matt

Macro to include contents of cell
 
Hi

I want to run a macro that inserts a particular variable value into a custom
filter.
I have a list of 40 names, any of which may appear in cell A1.
I need whatever that name is to be placed into a custom filter to then
display the portfolio of that person.

How do I write the macro so that is filters for the variable name in A1 each
time it changes?

Thanks

bpeltzer

Macro to include contents of cell
 
If your filtered table starts in, say, cell A10, and your filter criteria in
A1 should be applied to column A in your table, then the VBA would be
something like:
Range("A10").Select
Selection.AutoFilter Field:=1, Criteria1:=Range("A1").Value
--Bruce

"Matt" wrote:

Hi

I want to run a macro that inserts a particular variable value into a custom
filter.
I have a list of 40 names, any of which may appear in cell A1.
I need whatever that name is to be placed into a custom filter to then
display the portfolio of that person.

How do I write the macro so that is filters for the variable name in A1 each
time it changes?

Thanks



All times are GMT +1. The time now is 02:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com