I have a worksheet with certain columns containing formulas that I want to hardcode and store only the values. To do this, I created a named range containing the cells and then in VBA performed this operation:
However, this causes some issues. The problem seems to be that my range ("MyRange") contains cells that are not all adjacent to each other. So, for example, part of my range is in column C, and then another part of it in column E (but nothing in column D). The issue seems to be that it only keeps the values of the left-most cells, so it would replace what is in column E with data from column C.
Is there something I'm doing wrong with this code? Or can .Value not be used in ranges that contain non-adjacent cells?
Thanks
Sheet1.Range("MyRange").Value = Sheet1.Range("MyRange").Value
However, this causes some issues. The problem seems to be that my range ("MyRange") contains cells that are not all adjacent to each other. So, for example, part of my range is in column C, and then another part of it in column E (but nothing in column D). The issue seems to be that it only keeps the values of the left-most cells, so it would replace what is in column E with data from column C.
Is there something I'm doing wrong with this code? Or can .Value not be used in ranges that contain non-adjacent cells?
Thanks