Next empty cell in table column M

isaacv22

New Member
Joined
Sep 30, 2021
Messages
48
Office Version
  1. 365
Platform
  1. Windows
Hello,

I'm trying to figure out how to get this formula to find the next empty cell in a table. It was working fine before I had converted my data into a table and the previous formula is below. I would like this function to work while the data is in a table.

Sub Next_Empty_Row_M()
'
'selects the next empty row
'ignores blanks inbetween the data set

Range("M" & Rows.Count).End(xlUp).Offset(1).Select
End sub
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Try:
VBA Code:
Range("M:M").Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Offset(1).Select
 
Upvote 0
Solution
The above answer seems to find the last row in column M
But the user mentioned using a Table. A column in a Table may not be column M.
I would think the answer would be something like this:

VBA Code:
Sub My_New_Table()
'Modified 10/27/2021  1:13:15 PM  EDT
Dim ans As Long
ans = ActiveSheet.ListObjects("Table1").DataBodyRange.Rows.Count
MsgBox ans
End Sub
 
Upvote 0
That simply returns the number of data rows in a table (not necessarily the last row of the table), not the first empty cell in a particular column of the table.
 
Upvote 0
That simply returns the number of data rows in a table (not necessarily the last row of the table), not the first empty cell in a particular column of the table.
Yes I know that but that's the best answer I have. How do you find first empty cell in a Table column?
And actually the previous answer finds the last filled cell in a column not the first empty cell.
 
Last edited:
Upvote 0
actually the previous answer finds the last filled cell in a column not the first empty cell.
Judging from the code the OP posted, that's exactly what is required. The last filled cell offset 1 row is often the first blank cell.
 
Upvote 0
Original post said:
next empty cell in a table
sure:
You said:
often the first blank cell.

But not always: I could have values in row 1 and 2 and then 5
So first empty cell would be 3

And my major point is when referring to Tables you need to mention the Table Name
Not column M which might not be a part of the Table
 
Upvote 0
And my major point is when referring to Tables you need to mention the Table Name
Actually you don't.
The code that Akuini supplied will almost certainly do exactly what the OP requires. So it's best to wait & see what the OP says.
 
Upvote 0
You said:
actually you don't

So then how do you refer to a specific Table.
I know you can refer to the Table Range
Like this:
Range("Table1").Select
 
Upvote 0
Please stop "hijacking" this thread. The OP asked a very specific question, which was answered in post#2. We are now up to post#10 with stuff that has nothing to do with the question asked.
 
Upvote 0

Forum statistics

Threads
1,215,046
Messages
6,122,852
Members
449,096
Latest member
Erald

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