View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jim Jackson Jim Jackson is offline
external usenet poster
 
Posts: 324
Default Help - Nested IF

V = InputBox("Enter your choice. (Cars, Trucks, SUVs, Vans)")
Selection.AutoFilter Field:=1, Criteria1:= V

Range("D5:T20000").Select
Selection.Sort Key1:=Range("H5"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("H5").Select

End Sub
--
Best wishes,

Jim


"wjsdoh" wrote:

The code below is from the macro button that I created. Basically, the
selection filter which was created from the "Create List" of the Data option
on the Main Menu. I have 4 items in the list: Cars, Trucks, SUVs, Vans.
When I select "Trucks" from the list, it selects the rows for the truck range
which are rows D5 thru T4320 and it hides all the other rows which is
correct. At this point I can click on any one of the macro buttons that I
have created in row 4 columns H - S and get a descending sort of all the row
data from D5 thru T4320;

Range("A4").Select
Selection.AutoFilter Field:=1, Criteria1:="Trucks"
Range("D5:T4320").Select
Selection.Sort Key1:=Range("H5"), Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("H5").Select

End Sub
What I need is to be able to select Cars from the list and get the range of
rows D4321 thru T12678; or select SUVs and get the range of rows D12679 thru
T19886 etc. Please HELP!!!!

"Jim Jackson" wrote:

Let us see the code you have and we can have a better grip on what you are
attempting.
--
Best wishes,

Jim


"wjsdoh" wrote:

I have a worksheet that has a specific row-filtered list of 4 choices in
column A. If you select choice 1 from column A, choice 1 selects rows 5 thru
4831 only which is correct. There is a sort macro button in row 4 of each
column H thru S - each of the columns H thru S have been assigned a macro
that will sort the selected range of rows in descending rank for the specific
column and rows -- for choice 1, it will rank the rows 5 thru 4831.
I'd like to be able to select choice 2 and have the rows for choice 2 which
are 4832 thru 12678 selected. Then I'd like to be able to select one of the
sort macro buttons in row 4 of one of the columns H thru S and have the macro
sort only the selected rows for choice 2, rows 4832 thru 12678.
And the same for choice 3 which refers to rows 12679 thru 19886; and the
same for choice 4 which refers to rows 19887 thru 26741.