Mohammad Ishaq
Member
Previously in this form i was helped to correct my vba code for running total.But that time the code is for the whole workbook and the code was running very well.
But now according to my need i want to set the code only for a specific sheet.Not for the whole workbook.
I want the code to set only for sheet 1.
I have change the code for the sheet1 only.But it is not working.
It should be note that i enter the data through user form not manually.
I request you that please let me help to set the code only for a specific sheet not for the whole workbook.
But now according to my need i want to set the code only for a specific sheet.Not for the whole workbook.
I want the code to set only for sheet 1.
I have change the code for the sheet1 only.But it is not working.
It should be note that i enter the data through user form not manually.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Long
Application.EnableEvents = False
On Error GoTo eh
i = Range("D" & Rows.Count).End(xlUp).Row
Sh.Cells(i, "G").Value = Sh.Cells(i - 1, "G").Value + Sh.Cells(i, "E").Value - Sh.Cells(i, "F").Value
eh:
Application.EnableEvents = True
End Sub
I request you that please let me help to set the code only for a specific sheet not for the whole workbook.