Link to home
Create AccountLog in
Avatar of Svgmassive
Svgmassive

asked on

First blank in a non contiguous range

I am trying to find a formula/code to find the first blank in the range below.Thanks
$F$15:$F$20,$F$22:$F$27,$F$29:$F$34,$F$36:$F$41
Avatar of etech0
etech0
Flag of United States of America image

You can try code like this. It selects the first blank cell in the range you specified, and you can change the range in the third line of the code.

Sub FindBlank()

    Dim rng As Range
    Set rng = Range("$F$15:$F$20,$F$22:$F$27,$F$29:$F$34,$F$36:$F$41")
    For Each cell In rng
        If cell.Value = "" Then cell.Select: Exit Sub
    Next cell
    
End Sub

Open in new window

Avatar of Saqib Husain
No need to iterate. You can use
Sub a()
Debug.Print Range("$F$15:$F$20,$F$22:$F$27,$F$29:$F$34,$F$36:$F$41").SpecialCells(xlCellTypeBlanks).Offset(, 1).Cells(1).Address
End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of byundt
byundt
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer