I am new with VBA and I am working on a table which has electric vehicle loads. I have to check some conditions, if the conditions are not satisfied the car load should be decreased.
I have the following code but instead of reducing the load eg. from 11 to 10 or 9 or so on, it just deletes the load from the table. screenshots of starting case and after running code are attached.
Can someone help to correct the code?
Sub loopwork()
Column = 215
Row = 1097
columnmove = 109
For Column = 215 To 315
columnmove = columnmove + 1
For Row = 1097 To 1192
columnload = Column - columnmove
Cells(Row, Column).Select
Cells(Row, Column - 211).Select
Cells(Row, columnload).Select
self = Cells(Row, Column)
firstcheck = Cells(Row, Column - 211)
loadvalue = Cells(Row, columnload)
If ((firstcheck < -0.05 Or firstcheck > 0.05 Or loadvalue > 100) And (self > 0)) Then
Cells(Row, Column).Select
Cells(Row, Column) = Cells(Row, Column) - 1
Cells(1, 1).Select
Row = Row - 1
End If
Next
Next
End Sub