Mega Code Archive

 
Categories / VisualBasic Script / Excel
 

Checks values in a range 10 rows by 5 columns with nested for loop

Sub CheckValues2()     Dim rwIndex As Integer     Dim colIndex As Integer     For rwIndex = 1 To 10          For colIndex = 1 To 5              With Cells(rwIndex, colIndex)                  If Not (.Value = 0) Then Cells(rwIndex, colIndex).Value = 0              End With          Next colIndex     Next rwIndex End Sub