FOR EACH Loop
Sub changesign()
Dim c As Range
For Each c In Range("a1:e50")
If IsNumeric(c.Value) Then
c.Value = c.Value * -1
End If
Next
End Sub
--------------------------------------------------------------------
Sub changesign()
Dim cell As Range
For Each cell In Range("A1:E10")
If Not cell.HasFormula Then
If IsNumeric(cell.Value) Then
cell.Value = cell.Value * -2
End If
End If
Next
End Sub
Sub abc()
For Each wb In Workbooks
Debug.Print wb.Name
Next
End Sub
--------------------------------------------------------------------------------------------------------------------
Sub abc()
For Each sh In ActiveWorkbook.Sheets
Debug.Print sh.Name
Next
End Sub
--------------------------------------------------------------------------------------------------
Sub av()
For Each c In Range("b3", "c10")
i = i + 1
c.Value = i
Next
End Sub
Sub av()
Dim a(4) As Integer
a(1) = 200
For Each x In a
Debug.Print x
Next
End Sub
Integer array will assign zero to all their elements by default but string arrays will contain blank text by default
0
200
0
0
0
No comments:
Post a Comment