i am trying to find the first blank cell in range $F$15:$L$17  starting from f15,f16,f17 etc. thanks
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Glenn RayExcel VBA DeveloperCommented:
Shortcut keystrokes:  Put your cursor in F15, then press [End] and then the [Down Arrow] key.

If you're looking for another solution (function or programmatic), please provide more specifics.

Glenn RayExcel VBA DeveloperCommented:
I also need to point out that your question title states "non blank cell" but your question says "first blank cell".  We'll need to know which one you really want if you're looking for another solution.
SvgmassiveAuthor Commented:
example attached.
thank you
CompTIA Network+

Prepare for the CompTIA Network+ exam by learning how to troubleshoot, configure, and manage both wired and wireless networks.

Martin LissOlder than dirtCommented:
Dim r As Range
Set r = Range($F$15:$L$17).SpecialCells(xlCellTypeBlanks)
MsgBox r.Row

Open in new window

SvgmassiveAuthor Commented:
sorry martin not what i am looking for
Glenn RayExcel VBA DeveloperCommented:
Tweaking Martin's code (missing quotes) to show all addresses with blanks:
Sub Blank_List()
    Dim r As Range
    Set r = Range("$F$15:$L$17").SpecialCells(xlCellTypeBlanks)
    MsgBox r.Address
End Sub

Open in new window

However, if you want the address of the first blank cell of a range when scanned first by rows, then columns, this code will provide the address:
Sub First_Blank()
    Dim rng As Range
    Dim cl As Object
    Dim intRow As Integer
    For intRow = 15 To 17
        Set rng = Range("$F$" & intRow & ":$L$" & intRow)
        For Each cl In rng
            If IsEmpty(cl) Then
                MsgBox cl.Address
                Exit Sub
            End If
        Next cl
    Next intRow
    'no blank found - message
    MsgBox "No empty cells found in the specified range.", vbExclamation + vbOKOnly, "Notice"
End Sub

Open in new window

If you removed the For intRow = 15 to 17 loop and selected the entire range, the For Each...Next would scan by columns, then rows, returning $G$15 instead.

Rob HensonFinance AnalystCommented:
I assume you are wanting this as part of another script so that you can get it to enter a value into the first blank cell in the range.

If so how about for this logic:

Start at F15 - Do "End Right"  
If active column is less than 12 you haven't reached L, go one more right and populate as required;
If column is 12 (or greater) you have reached L (or beyond) so move back to F16 and repeat;
repeat for row 17 if required.

Rob H
Hakan YılmazProject EngineerCommented:
I attach a sample with a custom function that gives the address of first blank cell in given range. First looks at columns and then rows.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Hakan YılmazProject EngineerCommented:
I noticed a mistake in attached file. (It was working, but for different range).
Updated function is below.

Option Explicit

Function firstblankinrange(ByRef myrange As Range) As String
    Dim itercol As Integer
    Dim iterrow As Integer
    For itercol = 1 To myrange.Columns.Count
        For iterrow = 1 To myrange.Rows.Count
            If myrange.Cells(iterrow, itercol).Value = "" Then
                firstblankinrange = myrange.Cells(iterrow, itercol).Address
                Exit Function
            End If
        Next iterrow
    Next itercol
End Function

Open in new window

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.