Can anyone help me with my code as follow:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Sheets("sheet1").Activate
Dim de As Range
Dim i, j As Integer
For Each de In Range("e1:e1000")
For i = 1 To 1000
For j = 1 To 4
de = Application.WorksheetFunction.Sum(Range(Cells(1, j), Cells(i, 1)))
Next j
Next i
Next de
End Sub
I have 5 columns, the fifth column is the total column and 1000 rows
this code does not give the correct total results in column (e1:e1000)
I think there are quite few solutions for this and it is very easy, but i can't find the correct answer.
Thanks for your inputs
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Sheets("sheet1").Activate
Dim de As Range
Dim i, j As Integer
For Each de In Range("e1:e1000")
For i = 1 To 1000
For j = 1 To 4
de = Application.WorksheetFunction.Sum(Range(Cells(1, j), Cells(i, 1)))
Next j
Next i
Next de
End Sub
I have 5 columns, the fifth column is the total column and 1000 rows
this code does not give the correct total results in column (e1:e1000)
I think there are quite few solutions for this and it is very easy, but i can't find the correct answer.
Thanks for your inputs