Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to write an array to a range without looping | Excel Worksheet Functions | |||
Looping thru a range of cells | New Users to Excel | |||
looping across columns in range? | Excel Discussion (Misc queries) | |||
Looping thru cells in a named range | Excel Programming | |||
looping cells though a named range | Excel Programming |