How can I copy 3 non-adjacent cells using ActiveCell.Row
?
Range("A" & ActiveCell.Row, "C" & ActiveCell.Row, "E" & ActiveCell.Row).Copy
Update: For further info follow - https://youtu.be/zjF7oLLgtms
To simplify things a little:
Range(Replace("A?,C?,E?", "?", ActiveCell.Row)).Copy
You have the ,
outside the ""
. You need to put them inside. See this
Range("A" & ActiveCell.Row & ",C" & ActiveCell.Row & ",E" & ActiveCell.Row).Copy
Try this:
Union(Cells(ActiveCell.Row, 1), Cells(ActiveCell.Row, 3), Cells(ActiveCell.Row, 5)).Copy
I think there is tons of way to do this, you might read this it will give you better insight.
I would have done:
Sub test()
Set x = Application.Union(Range("A" & ActiveCell.Row), Range("C" & ActiveCell.Row), Range("E" & ActiveCell.Row))
x.Copy
End Sub
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.