I’d like to define my variable with two sets of values. For example,
Dim i as integer
For i = 92 to 97 and 104 to 109
Can you explain the proper way to do this? Here is what I have –
Dim k As Integer
For k = 92 To 97
If Range("A" & k).Text = "#NUM!" Then
Range("A" & k).Select
Selection.ClearContents
Range("I" & k).Select
Selection.ClearContents
Range("J" & k).Select
Selection.ClearContents
End If
Next k
Dim j As Integer
For j = 104 To 109
If Range("A" & k).Text = "#NUM!" Then
Range("A" & j).Select
Selection.ClearContents
Range("I" & j).Select
Selection.ClearContents
Range("J" & j).Select
Selection.ClearContents
End If
Next j
I’d like to combine variables k and j. Thanks!
This seems to me like the logical way to go. I also cleaned up all those selects. They are unnecessary and can cause you trouble more than anything.