Note that if there is more than one "X" in any row, you will not necessarily get the uniform spacing between "X's" of the value in col J after you run this macro. I have not included any error handling in case col J contains a negative value, is empty or is non-numeric.

Code:

Sub chirolove()
Dim R As Range, Vin As Variant, Y As Variant, i As Long, j As Long, k As Long
Const F As String = "X"
Set R = Range("L11:DK185")
Vin = R.Value
Y = Range("J11:J185").Value
For i = 1 To UBound(Vin, 1)
For j = 1 To UBound(Vin, 2)
If Vin(i, j) = F Then
For k = j + Y(i, 1) To UBound(Vin, 2) Step Y(i, 1)
Vin(i, k) = F
Next k
End If
Next j
Next i
R.Value = Vin
End Sub

## Like this thread? Share it with others