I have value in column "k" and discount in column "a"
i want formula in vba such that discount get apportion and then deducted from value example 33184-(1073/10334133184) or 12444-(1073/10334112444)
the result should come in column b result should be blank where their is date
i have problem in last if code please help
Sub MODULE1()
Dim i As Long
Dim lastrow As Long
lastrow = Cells(Rows.Count, "G").End(xlUp).Row
Range("B2:B" & lastrow).Value = Range("P2:R" & lastrow).Value
For i = 2 To lastrow
With Rows(i)
If Not IsEmpty(.Columns("F")) Then
Cells(i, "A").Value = Cells(i, "K").Value
End If
If Not IsEmpty(.Columns("F")) Then
If IsEmpty(.Columns("J")) Then .Columns("J").Value = "unregister"
Else
.Columns("I").Value = .Columns("I").Offset(-1, 0).Value
.Columns("J").Value = .Columns("J").Offset(-1, 0).Value
.Columns("L").Value = .Columns("L").Offset(-1, 0).Value
.Columns("Q").Value = .Columns("Q").Offset(-1, 0).Value
.Columns("R").Value = .Columns("R").Offset(-1, 0).Value
.Columns("P").Value = .Columns("P").Offset(-1, 0).Value
.Columns("B").Value = .Columns("B").Offset(-1, 0).Value
.Columns("A").Value = .Columns("A").Offset(-1, 0).Value
End If
If IsEmpty(.Columns("F")) Then
Cells(i, "A").Value = Cells(i, "k").Value - (Cells(i, "b").Value /
Cells(i, "a").Value) * Cells(i, "k").Value
End If
End With
Next i
With Range("I2:S" & lastrow)
.Font.Name = "ARIAL"
.Font.Size = "9"
End With
Range("I2:S" & lastrow).NumberFormat = "$#,##0.00" End Sub
i have problem in last if code