PDA

View Full Version : Solved: looping between named ranges



philfer
01-18-2008, 12:51 PM
Hi,

I have a spreadsheet where cells i.e. A13, A25, A28 and A38 are named ranges (inflowstart, inflowend, outflowstart, outflowend)

I want to run a loop that looks between rows 13 and 25 and puts formulae in adjacent cells i.e B13 D13 etc

How do I run a loop that says if the row is between inflowstart and inflowend do something in the adjacent cells and then between outflowstart and outflowend put a different number in the adjacent cells

The issue is that the number or rows between inflowstart, unflowend, outflowstart and outflowend changes depending on the volume or items for that day, so the ranges are never always A13 etc

At the end of the days work I want to run a macro that deletes the rows between the ranges. How can I do this also

Thanks

Bob Phillips
01-19-2008, 02:56 AM
Public Sub philfer()
Dim i As Long

With ActiveSheet

For i = .Range("inflowstart").Row To .Range("outflowend").Row

'your code - i points to the row
Next i

.Range("inflowstart").Resize(.Range("outflowend").Row - _
.Range("inflowstart").Row + 1).EntireRow.Delete
End With

End Sub