'excel vba select range between two numbers

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


Solution 1:[1]

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

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sam