Hey guys,
i would like to ask you for help. Icreating macro to copy cell (with formula) to right cell (it will be variable- 3 or 4 cells etc.) from multiple selection.
And also should be variable how many times it will be copied
<tbody>
</tbody>
After macro should be like this:
Variables:
<tbody>
</tbody>
My try is this, but it doesnt work. it copy only once and with the exact formula from original cell.
Thank you for your help
i would like to ask you for help. Icreating macro to copy cell (with formula) to right cell (it will be variable- 3 or 4 cells etc.) from multiple selection.
And also should be variable how many times it will be copied
A | B | C | D | E | F | G | H | I | |
1 | =SUM(A2:A3 ) | ||||||||
2 | 1 | ||||||||
3 | 2 | ||||||||
4 | |||||||||
5 | =SUM(A6:A7 ) | ||||||||
6 | 3 | ||||||||
7 | 4 |
<tbody>
</tbody>
After macro should be like this:
Variables:
- 2x copy to right
- offset 2
A | B | C | D | E | F | G | H | I | |
1 | =SUM(A2:A3 ) | =SUM(C2:C3) | =SUM(E2:E3) | ||||||
2 | 1 | ||||||||
3 | 2 | ||||||||
4 | |||||||||
5 | =SUM(A6:A7 ) | =SUM(C6:C7) | =SUM(E6:E7) | ||||||
6 | 3 | ||||||||
7 | 4 |
<tbody>
</tbody>
My try is this, but it doesnt work. it copy only once and with the exact formula from original cell.
Code:
Sub Formula_multiCopy()
Dim rng As Range
' The looping routine
Set rng = Selection
Do Until IsEmpty(rng)
rng.Offset(, 2) = rng.Formula
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Loop
End Sub
Thank you for your help