Macro button to go to the last non-blank cell in column

adorlytanglao

New Member
Joined
Jun 23, 2013
Messages
46
I want to have macro form button with a code on it that when click the selected cell will be the last non-empty cell on the Column B. Note B1 is non-empty. because that's where I'm keeping the visibility of the button. Also the Column is pre-filled with data(ID No.) thats why i need the code to check the Column B. Please let me know if there are more information needed.
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Thanks for the response. it doesn't work, it is going to the last cell of Column inside the table. My table is extending until row 703 and its selecting B703. But non-empty cell in column B is 417, so it should select B417.
 
Upvote 0
Are your empty cells actually empty or are they actually "" as results of formula?
 
Upvote 0
They are empty cells, not results of formula. However, andrew already fixed the formula. I just forgot to mention i have a table.
 
Upvote 0
Just realized something on my requirement. I applied the same formula on a different sheet, apparently some cells on ColumnB are empty and they are between non-empty cells. For example, using the same setup, the button selects B417. However i tried, emptying the B320 and upon clicking the button it went to the said cell.
 
Upvote 0
Try the code below. Change your table name to suit.

Code:
Sub ZZZ()
ActiveSheet.ListObjects("Table1").ListColumns(2).Range.Find(What:="*", SearchOrder:=xlRows, SearchDirection:=xlPrevious, LookIn:=xlValues).Select
End Sub
 
Upvote 0
Does this work for you?

Code:
Sub Test()
    Dim Rng As Range
    With ActiveSheet.ListObjects(1)
        Set Rng = .Range
        .Resize .Range.Rows("1:2")
        .Parent.Range("B" & .Parent.Rows.Count).End(xlUp).Offset(1).Select
        .Resize Rng
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,875
Members
452,363
Latest member
merico17

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