cmc
cmc

Reputation: 27

Faster way of looping through each cell in a defined range - with offsets?

Here's the code I'm using

For Each x In strText
    x.Offset(, 3).FormulaR1C1 = "=removeduplicates(RC[-1])"
    x.Offset(, 2).Value = x.Offset(, 3).Value
    x.Offset(, 3).ClearContents
Next x

The issue is that the range is 10,000 cells over 15 sheets so this takes ages. Is there any way to do this faster?

Upvotes: 0

Views: 169

Answers (1)

DisplayName
DisplayName

Reputation: 13386

Try this

With strText
    .Offset(, 3).FormulaR1C1 = "=removeduplicates(RC[-1])"
    .Offset(, 2).Value = .Offset(, 3).Value
    .Offset(, 3).ClearContents
End With

Upvotes: 3

Related Questions