a one liner?:Code:Range("C2:C6").Value = [A2:A6+B2:B6]
I have this code:
Is this really not possible?Or am I missing something?Code:Sub AddArray() Dim A1 As Variant Dim A2 As Variant A1 = Range("A2:A6").Value A2 = Range("B2:B6").Value Range("C2:C6").Value = A1 + A2 End Sub
Or else I really have to do it using loop.
a one liner?:Code:Range("C2:C6").Value = [A2:A6+B2:B6]
Nice! Is it faster compared to using a loop?
I'm actually trying to add the absolute value of the 2 arrays.
I manage to add the absolute values of 2 arrays using your idea below:
But the problem is line in "A" will be too long if I add more arrays.Code:Sub AddArray() A = [(if(isnumber(A1:A6),abs(A1:A6),A1:A6)) + (if(isnumber(B1:B6),abs(B1:B6),B1:B6))] [F1:F6] = A End Sub
I tried to use this one but won't work:
any suggestions?Code:Sub AddArray() A = [(if(isnumber(A1:A6),abs(A1:A6),A1:A6)) B =[(if(isnumber(B1:B6),abs(B1:B6),B1:B6))] [F1:F6] = [A+B] End Sub
Either loop, or put formulas into the target range and then replace them with values.
This website wants to know your momentum - | Deny | | Allow |
perhaps:
Range("C2:C6").Value = [INDEX(ABS(A2:A6),)+INDEX(ABS(B2:B6),)]
?
Bookmarks