Checks values in a range 10 rows by 5 columns with nested for loop : Cell Value « Excel « VBA / Excel / Access / Word






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

 








Related examples in the same category

1.Define a string type variable and set to Cell(1,D)
2.StrConv("ALL LOWERCASE ", vbLowerCase)
3.Format("ALL LOWERCASE ", "<")
4.Checks values in a range 10 rows by 5 columns
5.Place the value (result) of a formula into a cell rather than the formula.
6.Validation with a Spreadsheet Cell
7.Assing value in Cells to array, do the bubble sort and assign them back
8.transposes the values of a group of cells in a worksheet
9.Determining a cell's data type
10.Calculate cell