Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I am building a macro so that people in my organization can produce reports
based on a customer satisfaction spreadsheet database. I need to be able to pull data from the customer responses based on date ranges and I am thinking that the autofilter is the best choice for this. I want people to be able to input a from date for the greater than = to choice in autofilter and input and end date for the less than = to choice. I would then like to have them click on a radio button to initiate the macro and have the macro run the routine to pull the information to a query spreadsheet from the satisfaction spreadsheet based on the dates given. Piece of cake I am sure for you MVP types, but I am stumped on how to have the autofilter pull the dates for the query from the input cells. :( Your help would be hugely appreciated. |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="=subroutine", Operator:=xlAnd _ , Criteria2:="<=subroutine2" Sorry Don, I have never done this before. (see sheepish expression on my face). It is in the part for criteria 1 and criteria 2 that I need the macro to pause for input, or else to reference another cell in the first or second row of the spreadsheet to get the date from and date to. Thanks for your help! "Don Guillett" wrote: As always, post your coding efforts for comments and suggestions. c1 = InputBox("Enter Criteria 1") MsgBox c1 -- Don Guillett SalesAid Software "Lorna B" wrote in message ... I am building a macro so that people in my organization can produce reports based on a customer satisfaction spreadsheet database. I need to be able to pull data from the customer responses based on date ranges and I am thinking that the autofilter is the best choice for this. I want people to be able to input a from date for the greater than = to choice in autofilter and input and end date for the less than = to choice. I would then like to have them click on a radio button to initiate the macro and have the macro run the routine to pull the information to a query spreadsheet from the satisfaction spreadsheet based on the dates given. Piece of cake I am sure for you MVP types, but I am stumped on how to have the autofilter pull the dates for the query from the input cells. :( Your help would be hugely appreciated. |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
try this. I didn't test. BTW, you should try to NOT use selections. Use the
range instead. I suspect that the rest of your code is also full of unnecessary and undesirable selections. c1 = InputBox("Enter Criteria 1") c2= InputBox("Enter Criteria 2") Selection.AutoFilter Selection.AutoFilter Field:=1, Criteria1:="=" & c1 &", Operator:=xlAnd _ , Criteria2:="<=" & c2 -- Don Guillett SalesAid Software "Lorna B" wrote in message ... Selection.AutoFilter Selection.AutoFilter Field:=1, Criteria1:="=subroutine", Operator:=xlAnd _ , Criteria2:="<=subroutine2" Sorry Don, I have never done this before. (see sheepish expression on my face). It is in the part for criteria 1 and criteria 2 that I need the macro to pause for input, or else to reference another cell in the first or second row of the spreadsheet to get the date from and date to. Thanks for your help! "Don Guillett" wrote: As always, post your coding efforts for comments and suggestions. c1 = InputBox("Enter Criteria 1") MsgBox c1 -- Don Guillett SalesAid Software "Lorna B" wrote in message ... I am building a macro so that people in my organization can produce reports based on a customer satisfaction spreadsheet database. I need to be able to pull data from the customer responses based on date ranges and I am thinking that the autofilter is the best choice for this. I want people to be able to input a from date for the greater than = to choice in autofilter and input and end date for the less than = to choice. I would then like to have them click on a radio button to initiate the macro and have the macro run the routine to pull the information to a query spreadsheet from the satisfaction spreadsheet based on the dates given. Piece of cake I am sure for you MVP types, but I am stumped on how to have the autofilter pull the dates for the query from the input cells. :( Your help would be hugely appreciated. |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I must be a real idiot. Thank you so much for being so helpful. I have
changed my code, however when I test the macro I get a runtime error at the "Selection.AutoFilter" "Don Guillett" wrote: try this. I didn't test. BTW, you should try to NOT use selections. Use the range instead. I suspect that the rest of your code is also full of unnecessary and undesirable selections. c1 = InputBox("Enter Criteria 1") c2= InputBox("Enter Criteria 2") Selection.AutoFilter Selection.AutoFilter Field:=1, Criteria1:="=" & c1 &", Operator:=xlAnd _ , Criteria2:="<=" & c2 -- Don Guillett SalesAid Software "Lorna B" wrote in message ... Selection.AutoFilter Selection.AutoFilter Field:=1, Criteria1:="=subroutine", Operator:=xlAnd _ , Criteria2:="<=subroutine2" Sorry Don, I have never done this before. (see sheepish expression on my face). It is in the part for criteria 1 and criteria 2 that I need the macro to pause for input, or else to reference another cell in the first or second row of the spreadsheet to get the date from and date to. Thanks for your help! "Don Guillett" wrote: As always, post your coding efforts for comments and suggestions. c1 = InputBox("Enter Criteria 1") MsgBox c1 -- Don Guillett SalesAid Software "Lorna B" wrote in message ... I am building a macro so that people in my organization can produce reports based on a customer satisfaction spreadsheet database. I need to be able to pull data from the customer responses based on date ranges and I am thinking that the autofilter is the best choice for this. I want people to be able to input a from date for the greater than = to choice in autofilter and input and end date for the less than = to choice. I would then like to have them click on a radio button to initiate the macro and have the macro run the routine to pull the information to a query spreadsheet from the satisfaction spreadsheet based on the dates given. Piece of cake I am sure for you MVP types, but I am stumped on how to have the autofilter pull the dates for the query from the input cells. :( Your help would be hugely appreciated. |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I had "" wrong. NOW tested. Use the top of your range
Sub FilterInputCriteria() c1 = InputBox("Enter Criteria 1") c2 = InputBox("Enter Criteria 2") With Range("A7:D7") .AutoFilter .AutoFilter Field:=1, Criteria1:="=" & c1 & "" _ , Operator:=xlAnd, Criteria2:="<=" & c2 & "" End With End Sub -- Don Guillett SalesAid Software "Lorna B" wrote in message ... I must be a real idiot. Thank you so much for being so helpful. I have changed my code, however when I test the macro I get a runtime error at the "Selection.AutoFilter" "Don Guillett" wrote: try this. I didn't test. BTW, you should try to NOT use selections. Use the range instead. I suspect that the rest of your code is also full of unnecessary and undesirable selections. c1 = InputBox("Enter Criteria 1") c2= InputBox("Enter Criteria 2") Selection.AutoFilter Selection.AutoFilter Field:=1, Criteria1:="=" & c1 &", Operator:=xlAnd _ , Criteria2:="<=" & c2 -- Don Guillett SalesAid Software "Lorna B" wrote in message ... Selection.AutoFilter Selection.AutoFilter Field:=1, Criteria1:="=subroutine", Operator:=xlAnd _ , Criteria2:="<=subroutine2" Sorry Don, I have never done this before. (see sheepish expression on my face). It is in the part for criteria 1 and criteria 2 that I need the macro to pause for input, or else to reference another cell in the first or second row of the spreadsheet to get the date from and date to. Thanks for your help! "Don Guillett" wrote: As always, post your coding efforts for comments and suggestions. c1 = InputBox("Enter Criteria 1") MsgBox c1 -- Don Guillett SalesAid Software "Lorna B" wrote in message ... I am building a macro so that people in my organization can produce reports based on a customer satisfaction spreadsheet database. I need to be able to pull data from the customer responses based on date ranges and I am thinking that the autofilter is the best choice for this. I want people to be able to input a from date for the greater than = to choice in autofilter and input and end date for the less than = to choice. I would then like to have them click on a radio button to initiate the macro and have the macro run the routine to pull the information to a query spreadsheet from the satisfaction spreadsheet based on the dates given. Piece of cake I am sure for you MVP types, but I am stumped on how to have the autofilter pull the dates for the query from the input cells. :( Your help would be hugely appreciated. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can I use a macro to autofilter in excel | Excel Worksheet Functions | |||
autofilter macro | Excel Discussion (Misc queries) | |||
macro for 4 constraints in autofilter | Excel Discussion (Misc queries) | |||
Keep autofilter after macro is run | Excel Worksheet Functions | |||
Autofilter Macro Help | Excel Discussion (Misc queries) |