PDA

View Full Version : Solved: Do Loop until rowHeight is between two numbers



jazzyt2u
07-31-2008, 10:51 AM
Hi,

I'm having a brain fart.:banghead:

How would I code a Do... Loop to stop once the row height of a range reaches greater than let's say 60 but less or equal to 70.
Right now I have until greater than 60.

Range("D31").Select
Dim rngT10 As Range
Set rngT10 = Selection
Do Until Range(rngT10, ActiveCell).Height > 60
ActiveCell.Offset(1, 0).Select
Loop

jazzyt2u
07-31-2008, 11:00 AM
My brain has recovered...

Thanks...

Do Until Range(rngT10, ActiveCell).Height > 60 And Range(rngT10, ActiveCell).Height < 110

mdmackillop
07-31-2008, 12:18 PM
Try to avoid selecting to speed up your code

Sub Test()
Dim rngT10 As Range
Set rngT10 = Range("D31")
Do
i = i + 1
Loop Until Range(rngT10, rngT10.Offset(i)).Height > 60
rngT10.Offset(i).Select
End Sub