Hello All,
I referred to the earlier post from 2004 but didn't post my queries due to aging of the thread but my queries as same, so please help .
Earlier Post : https://www.mrexcel.com/forum/excel-questions/67250-counting-number-times-cell-value-changes.html
I tried using the VBA given in the link, but it didn't work in my case.
[TABLE="width: 363"]
<tbody>[TR]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]D[/TD]
[/TR]
[TR]
[TD="align: center"]Detected Date[/TD]
[TD="align: center"]Target Date[/TD]
[TD="align: center"]Actual Date[/TD]
[TD="align: center"]Time Change Counter[/TD]
[/TR]
[TR]
[TD="align: center"]19-Jan-19[/TD]
[TD="align: center"]23-Feb-19[/TD]
[TD="align: center"]4-Mar-19[/TD]
[TD="align: center"]Need incremental counter when value changes in column C<need incremental="" counter="" for="" changed="" to="" cell="" in="" c=""></need>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Please assist.
I used the below codes posted by Derek.
Different approach:
Paste this as the worksheet event:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Target.Column = 1 Then Target.Offset(0, 1).Value = 1
End Sub
Paste this in ThisWorkBook:
Private Sub Workbook_Open()
Columns("B:B").Select
Selection.Copy
Range("C1").Select
Selection.PasteSpecial Paste:=xlAll, Operation:=xlAdd, SkipBlanks:=False _
, Transpose:=False
Application.CutCopyMode = False
Columns("B:B").ClearContents
End Sub
I referred to the earlier post from 2004 but didn't post my queries due to aging of the thread but my queries as same, so please help .
Earlier Post : https://www.mrexcel.com/forum/excel-questions/67250-counting-number-times-cell-value-changes.html
I tried using the VBA given in the link, but it didn't work in my case.
[TABLE="width: 363"]
<tbody>[TR]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]D[/TD]
[/TR]
[TR]
[TD="align: center"]Detected Date[/TD]
[TD="align: center"]Target Date[/TD]
[TD="align: center"]Actual Date[/TD]
[TD="align: center"]Time Change Counter[/TD]
[/TR]
[TR]
[TD="align: center"]19-Jan-19[/TD]
[TD="align: center"]23-Feb-19[/TD]
[TD="align: center"]4-Mar-19[/TD]
[TD="align: center"]Need incremental counter when value changes in column C<need incremental="" counter="" for="" changed="" to="" cell="" in="" c=""></need>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Please assist.
I used the below codes posted by Derek.
Different approach:
Paste this as the worksheet event:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Target.Column = 1 Then Target.Offset(0, 1).Value = 1
End Sub
Paste this in ThisWorkBook:
Private Sub Workbook_Open()
Columns("B:B").Select
Selection.Copy
Range("C1").Select
Selection.PasteSpecial Paste:=xlAll, Operation:=xlAdd, SkipBlanks:=False _
, Transpose:=False
Application.CutCopyMode = False
Columns("B:B").ClearContents
End Sub
Last edited: