FIND AND GO TO THE LAST BLANK CELL IN A CERTAIN COLUMN

Joined
Oct 19, 2020
Messages
9
Office Version
  1. 365
Platform
  1. Windows
Hello All!

I have a worksheet with values in columns A:F, but not all the columns have equally filled rows.
I'd like to have a VBA to find and go to the last empty cell in column C, i.e. in cell C6 in my example.
Of course, the real worksheet has much more rows.
Thank you!
 

Attachments

  • Worksheet Example.jpg
    Worksheet Example.jpg
    23.6 KB · Views: 5

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Does this do it?
VBA Code:
Sub FindNextBlankCell()
    Dim blank_row As Long, blank_cell As Range
    blank_row = Sheets("Sheet1").Range("C1").End(xlDown).Row + 1
    Set blank_cell = Sheets("Sheet1").Cells(blank_row, 3)
    blank_cell.Select ' Do whatever you want with this cell
    End Sub

Adjust the "Sheet1" to the actual sheet name.
 
Upvote 0
If on the Activesheet try...
VBA Code:
Sub Mitache()
 Columns(3).Find("*", , xlValues, , xlByRows, xlPrevious).Offset(1).Select
End Sub
 
Upvote 0
Sheet1 has to be the Activesheet or your code will error (the code will also not treat the cells with "" as blank [post 2])
You're right. I nearly never use .Select, so I put it in as a placeholder, but I should have selected the Sheet to make it actually work from other worksheets:
VBA Code:
Sub FindNextBlankCell()
    Dim blank_row As Long, blank_cell As Range
    With Sheets("Sheet1")
        blank_row = .Range("C1").End(xlDown).Row + 1
        Set blank_cell = .Cells(blank_row, 3)
        .Select ' Only needed if you're actually using Select below
        blank_cell.Select ' Select is just an example that shows which cell was found.
    End With
    End Sub

If you don't use .Select, you should be able to do what you want with the cell without bothering with
 
Upvote 0
@Vogateer The other option is to use Application.Goto
VBA Code:
Sub FindNextBlankCell2()
    Dim blank_row As Long, blank_cell As Range
    blank_row = Sheets("Sheet1").Range("C1").End(xlDown).Row + 1
    Set blank_cell = Sheets("Sheet1").Cells(blank_row, 3)
    Application.Goto blank_cell, True ' Do whatever you want with this cell
End Sub

There will still be the issue with the ""
 
Upvote 0
Yes, my idea isn't going to work. Sorry I missed the ="" issue.
 
Upvote 0
Does this do it?
VBA Code:
Sub FindNextBlankCell()
    Dim blank_row As Long, blank_cell As Range
    blank_row = Sheets("Sheet1").Range("C1").End(xlDown).Row + 1
    Set blank_cell = Sheets("Sheet1").Cells(blank_row, 3)
    blank_cell.Select ' Do whatever you want with this cell
    End Sub

Adjust the "Sheet1" to the actual sheet name.
It works, but if there are false blanks like "" in the cells below C5, the code sends to the last real empty cell, not to C6.
 
Upvote 0

Forum statistics

Threads
1,217,382
Messages
6,136,239
Members
450,000
Latest member
jgp19

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