Current Region Property VBA

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


End Sub

Watch the video to understand the concept of the current region in Excel VBA:

Further Reading: CurrentRegion Property [Excel 2003 VBA Language Reference]

Leave a Reply

Your email address will not be published. Required fields are marked *