9thOctober
New Member
- Joined
- Nov 21, 2022
- Messages
- 1
- Office Version
- 2021
Hello i have this code
But it doesnt work, the selection should be
But with that code it is always Y = 22, the values of Y can be fixed are always 8,22,36 and so on so basically adding 14 on the values before
Im trying to fix a value on Y based on X
It must skip from X 20 to X 23, from X 34 to 37 and so on always +14 till forever
VBA Code:
For X = 9 To 36
For Y = 8 To 36 step 14
If WS1.Cells(X, 1) = "TOT" Then X = X + 2
SUM = WorksheetFunction.SumIfs(Prova1, Prova2, WS1.Cells(X, 1), Date, WS1.Cells(Y, 2), Prova3, Prova4)
WS1.Cells(X, 2) = SUM
Next Y
Next X
But it doesnt work, the selection should be
Code:
x=9 Y=8
x=10 Y=8
x=11 Y=8
x=12 Y=8
x=13 Y=8
x=14 Y=8
x=15 Y=8
x=16 Y=8
x=17 Y=8
x=18 Y=8
x=19 Y=8
x=20 Y=8 (it skips)
x=23 Y=22
x=24 Y=22
x=25 Y=22
x=26 Y=22
x=27 Y=22
x=28 Y=22
x=29 Y=22
x=30 Y=22
x=31 Y=22
x=32 Y=22
x=33 Y=22
x=34 Y=22
x=35 Y=22
But with that code it is always Y = 22, the values of Y can be fixed are always 8,22,36 and so on so basically adding 14 on the values before
Im trying to fix a value on Y based on X
It must skip from X 20 to X 23, from X 34 to 37 and so on always +14 till forever