code to jump to last cell without text

jrisebo

Active Member
Joined
Mar 15, 2011
Messages
322
Office Version
  1. 365
Platform
  1. Windows
Have a SS that has a ton of lines, would like a button that would jump to the next cell that does not have text. It can vary each time though.
Thanks
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
The column can be first column, A. The whole row will be empty.
 
Upvote 0
Have a SS that has a ton of lines, would like a button that would jump to the next cell that does not have text. It can vary each time though.
Thanks


Try this. Change the "G" to the letter of the column you need

Code:
Sub NextBlk()
  Range("[COLOR=#ff0000]G[/COLOR]" & Evaluate("=MIN(IF([COLOR=#ff0000]G[/COLOR]1:[COLOR=#ff0000]G[/COLOR]" & Range("[COLOR=#ff0000]G[/COLOR]" & Rows.Count).End(xlUp).Row + 1 & "="""", _
  ROW([COLOR=#ff0000]G[/COLOR]1:[COLOR=#ff0000]G[/COLOR]" & Range("[COLOR=#ff0000]G[/COLOR]" & Rows.Count).End(xlUp).Row + 1 & ")))")).Select
End Sub
 
Upvote 0
Code:
 Sub Last_Row()
 Dim lastRow As Long    
    lastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row + 1
     Range("A" & lastRow).Show
End Sub
 
Last edited:
Upvote 0
Try this. Change the "G" to the letter of the column you need

Code:
Sub NextBlk()
  Range("[COLOR=#ff0000]G[/COLOR]" & Evaluate("=MIN(IF([COLOR=#ff0000]G[/COLOR]1:[COLOR=#ff0000]G[/COLOR]" & Range("[COLOR=#ff0000]G[/COLOR]" & Rows.Count).End(xlUp).Row + 1 & "="""", _
  ROW([COLOR=#ff0000]G[/COLOR]1:[COLOR=#ff0000]G[/COLOR]" & Range("[COLOR=#ff0000]G[/COLOR]" & Rows.Count).End(xlUp).Row + 1 & ")))")).Select
End Sub

It didnt like this. I wanted it to be in a button to press. Gives me a compile error.
 
Upvote 0
The line was split

Try this

Code:
Sub NextBlk()
  Range("G" & Evaluate("=MIN(IF(G1:G" & Range("G" & Rows.Count).End(xlUp).Row + 1 & "="""", ROW(G1:G" & Range("G" & Rows.Count).End(xlUp).Row + 1 & ")))")).Select
End Sub

Create the button on your sheet and assign the macro.
Right click on your button.
Assign macro.
Select NextBlk
Press OK
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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