LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 98
Default Looping through a range of cells

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


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Looping thru a range of cells COBOL Dinosaur New Users to Excel 9 June 2nd 07 03:41 AM
Looping thru values in a Range of Cells PP Excel Programming 2 July 29th 05 04:12 PM
Looping through a range of cells rEN Excel Programming 4 June 10th 04 06:28 PM
Looping thru cells in a named range Michael Beckinsale Excel Programming 4 September 2nd 03 02:07 PM
looping cells though a named range Jo[_4_] Excel Programming 1 August 20th 03 12:32 AM


All times are GMT +1. The time now is 04:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"