i have calculation like this:
In first step macros appears result in column A in Rows 1, 2, 3 - then next calculation is A1, A2, A3 multiply with E1.
Second macros appears result in Column A in Rows 4, 5, 6 - then next calculation will be - macros check last row in Column B and make calculation with Column A&Lastrow+1 and with E3.
That i mean A4, A5, A6 multiply with E3.
I have Macros like this, but it not work...
Sub Test()
Dim Sh As Worksheet
Dim Rng As Range
Set Sh = ActiveSheet
lastrow = Range("b1").End(xlDown).Row
With Sh
Set Rng = .Range("b" & lastrow + 1 & ":b100")
End With
With Rng
.Formula = "= A & (Lastrow + 1) * $E$2 "
.Value = .Value
End With
End Sub
SpecifikacijaTest1.xls | |||||||
---|---|---|---|---|---|---|---|
A | B | C | D | E | |||
1 | 8 | =A1*E1 | 2 | ||||
2 | 7 | =A2*E1 | 3 | ||||
3 | 4 | =A3*E1 | |||||
4 | 3 | =A4*E2 | |||||
5 | 6 | =A5*E2 | |||||
6 | 5 | =A6*E2 | |||||
CutList |
In first step macros appears result in column A in Rows 1, 2, 3 - then next calculation is A1, A2, A3 multiply with E1.
Second macros appears result in Column A in Rows 4, 5, 6 - then next calculation will be - macros check last row in Column B and make calculation with Column A&Lastrow+1 and with E3.
That i mean A4, A5, A6 multiply with E3.
I have Macros like this, but it not work...
Sub Test()
Dim Sh As Worksheet
Dim Rng As Range
Set Sh = ActiveSheet
lastrow = Range("b1").End(xlDown).Row
With Sh
Set Rng = .Range("b" & lastrow + 1 & ":b100")
End With
With Rng
.Formula = "= A & (Lastrow + 1) * $E$2 "
.Value = .Value
End With
End Sub