Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default looping through a range

Hi
I need a bit of help with following code.
I am comparing a list on the sd page, if the value on the
sd page is false I want to clear the contents of a row on
the calc (2) page.
I need help to move the activecell down one each time the
macro runs a loop. Then it should work.
Thanks
Jo

Sheets("sd").Select
Range("ac28:ac37").Name = "sdrange"
For Each cell In Range("sdrange")
Sheets("calc (2)").Select
Range("A9").Select
If cell = False Then
Sheets("calc (2)").Select
ActiveCell.EntireRow.ClearContents
ActiveCell.Offset(1, 0).Select
End If

Next


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default looping through a range

If I read your intent correctly, ...................

Sub Tester()

Dim rngCell As Range
Dim rngClear As Range

Sheets("sd").Select
Range("ac28:ac37").Name = "sdrange"
Sheets("calc (2)").Select
Set rngClear = Range("A9")
For Each rngCell In Range("sdrange")
If rngCell.Value = False Then rngClear.EntireRow.ClearContents
Set rngClear = rngClear(2, 1)
Next rngCell

End Sub

Tested using Excel 97SR2 on Windows 98SE,

HTH
Paul
--------------------------------------------------------------------------------------------------------------
Be advised to back up your WorkBook before attempting to make changes.
--------------------------------------------------------------------------------------------------------------
Hi
I need a bit of help with following code.
I am comparing a list on the sd page, if the value on the
sd page is false I want to clear the contents of a row on
the calc (2) page.
I need help to move the activecell down one each time the
macro runs a loop. Then it should work.
Thanks
Jo

Sheets("sd").Select
Range("ac28:ac37").Name = "sdrange"
For Each cell In Range("sdrange")
Sheets("calc (2)").Select
Range("A9").Select
If cell = False Then
Sheets("calc (2)").Select
ActiveCell.EntireRow.ClearContents
ActiveCell.Offset(1, 0).Select
End If

Next


Reply
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
How to write an array to a range without looping Andy Excel Worksheet Functions 3 April 27th 11 12:52 PM
Looping thru a range of cells COBOL Dinosaur New Users to Excel 9 June 2nd 07 03:41 AM
looping across columns in range? Amy Excel Discussion (Misc queries) 3 July 19th 05 08:01 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 02:06 PM.

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

About Us

"It's about Microsoft Excel"