Looping through a range of cells
Never mind. I got it to work.
Thanks anyways.
Conan
"Conan Kelly" <CTBarbarin at
msn dot com wrote in message
...
Hello all,
I've been looking through
the Help files for this and
this is what they have
listed:
Sub RoundToZero2()
For Each c In
Worksheets("Sheet1").Range("A1:D10").Cells
If Abs(c.Value) <
0.01 Then c.Value = 0
Next
End Sub
The range I want to use in
this loop is already
selected (after pasting, the
pasted data is selected).
So I tried changing
"Worksheets("Sheet1").Range("A1:D10").Cells"
to
"ActiveWindow.RangeSelection.Cells".
No workie...
The other thing I'm
concerned about is the "For
Each c": Does "c" need to be
set to an object variable
(like a "Cell" or "Cells"
object or something like
that), or will Excel/VBA
automatically know that "c"
means each cell in the
range.
thanks for any help anyone
can provide,
Conan Kelly
|