'I want to have count of selected cells in F25 the way total is calucated in F24?
My current code looks like this. I want to show total of cells counted in cell F25. Further if there is any way to undo the changes by Macro or any other way that would be great. Currently I'm unable to undo any change It simply adds up any number I click from the range in cell in cell F24.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error GoTo this
Dim ws As Worksheet
Set ws = ActiveSheet
Dim col As Integer
Dim r As Integer
col = Target.Column
r = Target.row
If r >= 7 And r <= 16 And col >= 6 And col <= 16 And ws.Cells(r, col).Value <> "" Then
ws.Range("F24").Value = ws.Range("F24").Value + ws.Cells(r, col).Value
ws.Range("F25").Count = ws.Range("F25").Count + ws.Cells(r, col).Count
Else
End If
this:
Exit Sub
End Sub
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
