'VBA copy function inconsistent

Sheets("Median_make").Select
    Range("B3").Copy
     Range("H4").PasteSpecial xlPasteValues
Application.CutCopyMode = False
Sheets("Median_make").Select
    Range("E3").Copy
    Range("K4").PasteSpecial xlPasteValues
Sheets("Median_make").Select
    Range("D3").Copy
    Sheets("Median_make").Range("J4").PasteSpecial xlPasteValues
Application.CutCopyMode = False

I am trying to copy cell values from the same worksheet but somehow it doesn't work. It would only paste one value out of the three. I am very new to this, any help would be much appreciated.



Solution 1:[1]

The following code would perform your requirement and would not require you to have the sheet selected at all:

With Sheets("Median_make")
    .Range("H4").Value = .Range("B3").Value
    .Range("K4").Value = .Range("E3").Value
    .Range("J4").Value = .Range("D3").Value
End With

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 CLR