Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using predefined names in VBA

Tags:

vba

The code is really simple and I'm just trying to copy values in from_range and paste them in to_range. But it's just not working out...

Sub test14()
    Range("to_range") = Range("from_range")
End Sub

Before,

Before

After, not sure why everything in to_range is gone

After

Desired, just want to overwrite to_range with from_range

Desired

Could someone explain what's going on here? Thanks.

like image 929
Garry W Avatar asked Oct 22 '18 17:10

Garry W


1 Answers

also you can do this job with Select:

Range("from_range").Select
Selection.Copy
Range("to_range").Select
ActiveSheet.Paste
like image 124
ali Avatar answered Oct 17 '22 21:10

ali