Search for First Blank in Column

KORKIS2

Board Regular
Joined
Jun 5, 2015
Messages
143
I need to find the length of Column K to the First blank in the Column
Then store row # in a variable
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Try this array formula (CTRL+SHIFT+ENTER, not just Enter):

=MATCH(TRUE,K:K="",0)

Excel will surround your array formula with {} when entered correctly.
 
Upvote 0
I really appreciate your help I need it in macro form though sorry I didn't specify I have to add it to awhole bunch of other code.
 
Upvote 0
Someone else can probably write you something more efficient but this should work.

Code:
Sub FindLastK()
    
    Dim x As Long
    Dim y As Long
    
    For x = 1 To Range("K" & Rows.Count).End(xlUp).Row
        If Range("K" & x) = "" Then
            y = Range("K" & x).Row
            Exit For
        End If
    Next x
    
    MsgBox (y)
    
End Sub
 
Upvote 0
When you said "first blank cell", I assumed that there was a break in the data in column K. If you just want to find the last row of data, try:

Code:
Sub FindK()
    
    Dim x As Long
    
    x = Range("K" & Rows.Count).End(xlUp).Row
    MsgBox (x)
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,854
Members
449,051
Latest member
excelquestion515

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top