Sub
TestIt()
Dim
rngCol
As
Range, c
As
Range
Dim
f
As
Long
Dim
g
As
Long
Dim
strFrm
As
String
Dim
x
As
Long
Const
C_Formula
As
String
=
"=IF(R4CXX=0,0,Tabelle1!R[1]C*Tabelle2!R4CXX*Tabelle2!R6CXX*Tabelle2!R7CXX/Tabelle2!R8CXX*Tabelle2!R9CXX)"
f = 4
With
Sheets(
"Tabelle1"
)
g = Range(.Cells(2, f), .Cells(2, f).
End
(xlToRight)).Columns.Count
End
With
With
Sheets(
"Tabelle2"
)
.Cells.Clear
For
x = f
To
g
.Cells(2, x).Resize(9).FormulaR1C1 =
"=Tabelle1!RC"
.Cells(12, x).Resize(4).FormulaR1C1 =
"=Tabelle1!RC"
strFrm = Replace(C_Formula,
"XX"
, Format(x,
"0"
))
.Cells(18, x).Resize(211).FormulaR1C1 = strFrm
Next
x
End
With
End
Sub