Mohammad Ishaq
Member
Hello Friends,
I have a workbook having two sheets(sheet2 and sheet3).I have write one code with in both the sheets to calculate the running balance.
The code in the first sheet working well , but the second sheet do nothing.
The reason in the 2nd sheet is that the calculation is start from third row.
Now how i can set the same code for the 2nd sheet to start calculation from the 3rd row.
Code for sheet 2
I have upload the file also.
I have a workbook having two sheets(sheet2 and sheet3).I have write one code with in both the sheets to calculate the running balance.
The code in the first sheet working well , but the second sheet do nothing.
The reason in the 2nd sheet is that the calculation is start from third row.
Now how i can set the same code for the 2nd sheet to start calculation from the 3rd row.
Code for sheet 2
HTML:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim i As Long
i = Application.WorksheetFunction.CountA(Sheet2.Range("A:A"))
On Error Resume Next
Sheet2.Cells(i, "D").Value = Val(Sheet1.Cells(i - 1, "D")) + Val(Sheet2.Cells(i, "B")) - Val(Sheet2.Cells(i, "C"))
End Sub
I have upload the file also.