Playing different ranges in a table and overwriting the same tracks in VBA


I would like to read from distinct ranges, in which there are values calculated through some formula in those cells, in VBA and overwrite these ranges with the values that have been saved in order to automatically get rid of the formulae in the cells.

The code looks as follows:

allValues = Range("AR8:AW8,AR10:AW10,AR12:AW24,AR26:AW52,AR54:AW61,AR64:AW87,AR89:AW94,AR96:AW96,AR98:AW104,AR106:AW106,AR108:AW110,AR112:AW122,AR125:AW140,AR142:AW162,AR164:AW192,AR194:AW196,AR198:AW198,AR200:AW202,AR204:AW218,AR220:AW230,AR232:AW232,AR234:AW240").Value

Range("AR8:AW8,AR10:AW10,AR12:AW24,AR26:AW52,AR54:AW61,AR64:AW87,AR89:AW94,AR96:AW96,AR98:AW104,AR106:AW106,AR108:AW110,AR112:AW122,AR125:AW140,AR142:AW162,AR164:AW192,AR194:AW196,AR198:AW198,AR200:AW202,AR204:AW218,AR220:AW230,AR232:AW232,AR234:AW240")= allValues

For conjunctive ranges such an idea worked out but for these not at all.

I appreciate any input.

With a multi-area range, iterate on the areas:

Dim r As Range
For Each r In Sheet1.Range("AR8:AW8, AR10:AW10, ..., ...").Areas
    r.Value = r.Value