3
From now on I want to thank @Leandro Felipe Moreira for the help with the following code:
Sub teste()
rng = Columns(16).End(xlDown).Row
MsgBox rng
For i = 1 To rng
If Cells(i, 16).Value > "0" And Cells(i, 16).Value <= "100" Then
Range("U2").Select
ActiveCell.FormulaR1C1 = "=RC[-5]*1.69*(1+40%)"
lastrow = Range("A" & Rows.Count).End(xlUp).Row
Range("U2").AutoFill Destination:=Range("U2:U" & lastrow)
Selection.NumberFormat = "0"
ElseIf Cells(i, 16).Value > "100" And Cells(i, 16).Value <= "150" Then
Range("U2").Select
ActiveCell.FormulaR1C1 = "=RC[-5]*1.69*(1+35%)"
lastrow = Range("A" & Rows.Count).End(xlUp).Row
Range("U2").AutoFill Destination:=Range("U2:U" & lastrow)
Selection.NumberFormat = "0"
End If
Next i
End Sub
The problem is filling up to the last cell with:
Lastrow = Range("A" & Rows.Count).End(xlUp).Row
Range("U2").AutoFill Destination:=Range("U2:U" & Lastrow)
I want the calculation to be done in the correct cell. That is, look in column P1 and present the calculation in column U1 and successively.
You can help me with this @Evert?
– b8engl
Hello friend! Even if you mark with @NAME either in comment or in a question/answer the user does not receive this notification, unless you have already participated in your question/answer with a comment.
– Evert
Only hj saw your question and it’s good to have found your answer.
– Evert