Free Microsoft Excel Training Videos

Current Region property in Excel

If you don't know the boundaries of the range you want to loop through, you can use the CurrentRegion property in Excel to return the range that surrounds the active cell.
For example, the following procedure, when run from a worksheet, loops through the range that surrounds the active cell, setting to 0 all values less than 0.01.

 
Sub RoundToZero3()
For Each c In ActiveCell.CurrentRegion.Cells
If c.Value < 0.01 Then c.Value = 0
Next
End Sub








Further Reading

Current Region property in Excel