URGENT Please. How to change table filter greater than and less than to a specific value in a specific cell and in another worksheet?

Nicholas Agius

New Member
Joined
Apr 13, 2014
Messages
9
I would like to change the greater than number to the value in cell 'I11' in sheet 'Linear Programming Data' and the less than number to the value in cell 'I12' in sheet 'Linear Programming Data'. The code I am using was done by recording a macro since I don't know how to code in vba.

Code:
Sub Results2()
   ' Results2 Macro
   ' copy table filter power by greater than and less than


     Sheets("Finalizing Results 2").Select
     Cells.Select
     Selection.ClearContents
     Range("A1").Select
     Sheets("Finalizing Results 1").Select
     Range("Table33").Select
     Selection.Copy
     Sheets("Finalizing Results 2").Select
     Range("A2").Select
     Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
     Range("A1").Select
     Application.CutCopyMode = False
     ActiveCell.FormulaR1C1 = "Fuel"
     Range("B1").Select
     ActiveCell.FormulaR1C1 = "Power"
     Range("C1").Select
     ActiveCell.FormulaR1C1 = "Weight"
     Range("D1").Select
     ActiveCell.FormulaR1C1 = "Area"
     Range("A1:D10050").Select
     ActiveSheet.ListObjects.Add(xlSrcRange, Range("$A$1:$D$10050"), , xlYes).Name _
         = "Table34"
     Range("Table34[#All]").Select
     ActiveSheet.ListObjects("Table34").TableStyle = "TableStyleMedium15"
     Range("E3").Select
     ActiveSheet.ListObjects("Table34").Range.AutoFilter Field:=2, Criteria1:= _
         ">=122.6", Operator:=xlAnd, Criteria2:="<=132.6" 'I need to change the greater than number to the value in cell 'I11' in sheet 'Linear Programming Data' and the less than number to the value in cell 'I12' in sheet 'Linear Programming Data'.
     Range("E20").Select


 End Sub

Please Help me its very urgent and i need to finalize this work. if I don't find a solution for this i will be .........
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
You can use this:

Code:
ActiveSheet.ListObjects("Table34").Range.AutoFilter Field:=2, Criteria1:= _
         ">=" & sheets("Linear Programming Data").range("I11"). Value, Operator:=xlAnd, Criteria2:="<=" & sheets("Linear Programming Data").range("I12"). Value
 
Upvote 0

Forum statistics

Threads
1,215,382
Messages
6,124,618
Members
449,175
Latest member
Anniewonder

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