Answers for "VBA shell multiple commands"

VBA
0

Can we use multiple for command in VBA

Sub quarterlyAverage()
Dim breakStatus As Integer
breakStatus = 0
For i = 2 To 21
 newRange = Range(Cells(i, 2), Cells(i, 5))
 For j = 2 To 5
   Cells(i, j).Select
   If Cells(i, j) = 0 Then
     breakStatus = 1
     Exit For
     Else
       breakStatus = 0
     End If
   Next
 Range("J1").Value = breakStatus
 If breakStatus = 1 Then
   Cells(i, 6).Value = "Missing data"
   Else
     Cells(i, 6).Value = Application.Average(newRange)
   End If
 Next
End Sub
Posted by: Guest on December-09-2020

Code answers related to "VBA"

Browse Popular Code Answers by Language