PDA

View Full Version : excel vba range property non contiguous ranges



Ramo964516
03-02-2016, 01:28 PM
Hi everybody,


I just want to fill different non contiguous ranges from an original cell containing
Sum(E1:E4). Here's the code (wich doesn't work, just to get the idea clearer):



Selection.AutoFill Destination:=Range("K1:K4", "O1:O5", "Q1:Q5"), Type:=xlFillDefault


i don't know the correct synthax.
Thanks for your help

xld
03-02-2016, 03:34 PM
Why are you using autofll rather than just copy? Should the 2nd and 3rd range be 4 cells, not 5?

Ramo964516
03-04-2016, 02:43 AM
i want to do just like in the image. i don't know how exactly to do it, i was trying by using autofill but perhaps there is a better solution

15554

xld
03-04-2016, 03:56 PM
Like this


Range("F8").Copy Range("F9, F12:F13, F15:F16, F18, F20")

Ramo964516
03-06-2016, 03:46 AM
It works perfectly well. Thank you xld for your help, that's what i was looking for.