Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
macro Lookup
Hello,
I've set up a macro to filter a list using a week number. Obviously the week number changes. When i run the macro I have at the moment it keeps the original week number e.g. 44, every time it runs. I set it up so that you should be able to put the week number into cell "f2" and then the macro uses the value to filter the list by. What have I done wrong? |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
macro Lookup
Hard to tell without seeing any code.
-- __________________________________ HTH Bob "DamienO" wrote in message ... Hello, I've set up a macro to filter a list using a week number. Obviously the week number changes. When i run the macro I have at the moment it keeps the original week number e.g. 44, every time it runs. I set it up so that you should be able to put the week number into cell "f2" and then the macro uses the value to filter the list by. What have I done wrong? |
#3
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
macro Lookup
In VBA, AutoFilter likes strings:
Sub Macro1() Dim s As String, r As Range s = Range("F2").Value Set r = Range("G5:I22") r.AutoFilter Field:=1, Criteria1:=s End Sub where G5 thru I22 contains: alpha beta gamma 40 6 6 42 7 7 43 8 8 42 9 9 41 10 10 40 11 11 45 12 12 50 13 13 46 14 14 41 15 15 44 16 16 41 17 17 44 18 18 43 19 19 43 20 20 49 21 21 49 22 22 -- Gary''s Student - gsnu200908 "DamienO" wrote: Hello, I've set up a macro to filter a list using a week number. Obviously the week number changes. When i run the macro I have at the moment it keeps the original week number e.g. 44, every time it runs. I set it up so that you should be able to put the week number into cell "f2" and then the macro uses the value to filter the list by. What have I done wrong? |
#4
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
macro Lookup
HI,
That works for me after a little change on the sheet. Thanks for the help "Gary''s Student" wrote: In VBA, AutoFilter likes strings: Sub Macro1() Dim s As String, r As Range s = Range("F2").Value Set r = Range("G5:I22") r.AutoFilter Field:=1, Criteria1:=s End Sub where G5 thru I22 contains: alpha beta gamma 40 6 6 42 7 7 43 8 8 42 9 9 41 10 10 40 11 11 45 12 12 50 13 13 46 14 14 41 15 15 44 16 16 41 17 17 44 18 18 43 19 19 43 20 20 49 21 21 49 22 22 -- Gary''s Student - gsnu200908 "DamienO" wrote: Hello, I've set up a macro to filter a list using a week number. Obviously the week number changes. When i run the macro I have at the moment it keeps the original week number e.g. 44, every time it runs. I set it up so that you should be able to put the week number into cell "f2" and then the macro uses the value to filter the list by. What have I done wrong? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Run Lookup only once - Macro | Excel Discussion (Misc queries) | |||
lookup macro | Excel Discussion (Misc queries) | |||
Lookup macro | Excel Discussion (Misc queries) | |||
lookup macro?? | Excel Worksheet Functions | |||
Macro lookup | Excel Discussion (Misc queries) |