JoaoGabriel
New Member
- Joined
- Jun 6, 2021
- Messages
- 15
- Office Version
- 2019
- Platform
- Windows
I'm trying to create a macro that identifies with 1 when there is a change in row values and 0 when there isn't. Ignoring blank cells in both cases.
The data looks like this:
I got the following macro, but I couldn't ignore blank values and apply to multiple lines at once
Can anyone help?
The data looks like this:
I got the following macro, but I couldn't ignore blank values and apply to multiple lines at once
VBA Code:
Sub ValueChange()
Dim curR As Range
Set curR = Application.Selection
Set curR = Application.InputBox("Select the Range of Cells", xTitleId, curR.Address, Type:=8)
curR.Cells(1, 13).Value = 0
For i = curR.Columns.Count To 2 Step -1
If curR.Cells(1, i).Value <> curR.Cells(1, i - 1).Value Then
curR.Cells(1, 13).Value = 1
End If
Next
End Sub
Can anyone help?