Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can you do IsEmpty(Range)?
As I progress in VBA, I'm trying to make my macros more elegant and
less heavy-handed. One of those problems is how I end Do loops with embedded If loops. I was previously just inserting a stop point in the column. Something like 'Do Until ActiveCell = "End"'. That works ok, until the range I'm working on is much shorter than my stop range. Is it possible to use IsEmpty to test a 15 cell block, and if they're all empty to end, or insert my end point? I've tried using the following code, but it doesn't work. Range("C1").Select Do Until ActiveCell = "ZZZ" Range(ActiveCell, ActiveCell.Offset(15, 0)).Select If IsEmpty(Selection) = True Then ActiveCell.Offset(10, 0).Select ActiveCell.FormulaR1C1 = "ZZZ" Else: ActiveCell.Offset(5, 0).Select End If Loop Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can you do IsEmpty(Range)?
You have a response at your other post.
Sharkbait wrote: As I progress in VBA, I'm trying to make my macros more elegant and less heavy-handed. One of those problems is how I end Do loops with embedded If loops. I was previously just inserting a stop point in the column. Something like 'Do Until ActiveCell = "End"'. That works ok, until the range I'm working on is much shorter than my stop range. Is it possible to use IsEmpty to test a 15 cell block, and if they're all empty to end, or insert my end point? I've tried using the following code, but it doesn't work. Range("C1").Select Do Until ActiveCell = "ZZZ" Range(ActiveCell, ActiveCell.Offset(15, 0)).Select If IsEmpty(Selection) = True Then ActiveCell.Offset(10, 0).Select ActiveCell.FormulaR1C1 = "ZZZ" Else: ActiveCell.Offset(5, 0).Select End If Loop Thanks -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Either an "IsEmpty" or a Range issue.... | Excel Programming | |||
IsEmpty on a range/array | Excel Programming | |||
IsEmpty on a range/array | Excel Programming | |||
Help with IsEmpty | Excel Programming | |||
vba: isempty | Excel Programming |