VBA MOD01 Next Counter Loop

 

● Simple For…Next to conditionally add values (10) to Quantities greater than 400 




Public Sub Simple_For()

 Dim i As Long

 Dim lastrow As Long

 Dim myValue As Double

 Const StartRow As Byte = 10

 

 lastrow = Range("A" & StartRow).End(xlDown).Row

 For i = StartRow To lastrow

 myValue = Range("F" & i).Value

 If myValue > 400 Then Range("F" & i).Value = Range("F" & i).Value + 10

 If myValue < 0 Then Exit For

 

 Next i

 

End Sub





Comments

Popular posts from this blog

VBA01 Copy Resize Variably Sized Ranges

VBA MOD01 Passing Arguments to sub procedures (ByRef , By Val)

PY MOD01 Lecture 01