Help finding an empty cell

Dan Wilson

Well-known Member
Joined
Feb 5, 2006
Messages
507
Office Version
  1. 365
Platform
  1. Windows
Good day. I am running Excel out of Office365 (updated) on Windows 10 Home. I have a worksheet containing 5,000 song titles with data in 10 Columns. Column H contains a number if that song has been selected for use in a podcast. I have Macros to sort the worksheet. One of the Macros sorts the worksheet according to Column H. I would like to add a line to the end of the Macro so that after the sort has been accomplished, the display will put the cursor in the first Row where Column H is empty. Each week as the songs are selected for use, the number of cells with Comun H containing a number increases and I have to scan the worksheet to find the first empty Column H. Thank you for any help.
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
You can try something like this:
VBA Code:
Private Sub findemptycell()
Dim c As Long
Dim myRange As Range
Dim myCell As Range

Set myRange = Range("H1:H5000")

For Each myCell In myRange
    c = c + 1
    If IsEmpty(myCell) Then
        ActiveSheet.Cells(myCell.Row + 1, myCell.Column).Select
        Exit Sub
    End If
Next myCell
End Sub
 
Upvote 0
Maybe
VBA Code:
On Error Resume Next
    Columns("H:H").SpecialCells(xlCellTypeBlanks).Cells(1, 1).Select
On Error GoTo 0

The error code is just there in case it is ever run when there are no blank cells
 
Upvote 0
You can try something like this:
VBA Code:
Private Sub findemptycell()
Dim c As Long
Dim myRange As Range
Dim myCell As Range

Set myRange = Range("H1:H5000")

For Each myCell In myRange
    c = c + 1
    If IsEmpty(myCell) Then
        ActiveSheet.Cells(myCell.Row + 1, myCell.Column).Select
        Exit Sub
    End If
Next myCell
End Sub
Good day Candyman8019. Thank you for the quick response. I loaded your answer into my Macro and it worked exactly as I requested. I did have to remove the "+1" from
"ActiveSheet.Cells(myCell.Row + 1, myCell.Column).Select"
as the cursor was landing in the second open cell in Column H. Thank you again.
Dan...
 
Upvote 0

Forum statistics

Threads
1,214,652
Messages
6,120,746
Members
448,989
Latest member
mariah3

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