Home > Enterprise >  excel vba select range between two numbers
excel vba select range between two numbers

Time:04-12

Select range between two numbers

  1. C column is sorted from the input data
  2. From the sorted output, the selected range should be with in -0.25 to 0.25

How to add more than one criteria in COUNTIF function or its similar function?

Original syntax:

.Resize(Application.CountIf(.Cells, "<0")).Select

Requirement:

.Resize(Application.CountIf(.Cells, ">-0.25 & <0.25")).Select

CodePudding user response:

Replace CountIf with CountIfs when you want more than one condition. Try this:

.Resize(Application.WorksheetFunction.CountIfs(.Cells, ">-0.25", .Cells, "<0.25")).Select
  • Related