I want to copy values from one Excel column to another using VBA. To do it efficiently I use Range.Value. This works fine, except when the source range is filtered.
Sample VBA:
Sub Test()
Range("D2:D4").Value = Range("B2:B4").Value
End Sub
Run on this simple sample Worksheet produces the expected results:
Now filter the Source column to exclude values B. Running the Test VBA produces the following:
Cell D4 should have value C, not A. (Extending the sample data and filter produces more bizarre results when doing a Range.Value assignment.)
WTF is going on, and what reasonable VBA will do a correct copy of values when source data are filtered?

