code to jump to last cell without text

jrisebo

Board Regular
Joined
Mar 15, 2011
Messages
222
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
 

Some videos you may like

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
12,594
Office Version
  1. 2007
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


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
 

jondavis1987

Active Member
Joined
Dec 31, 2015
Messages
413
Office Version
  1. 2019
Platform
  1. Windows

ADVERTISEMENT

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:

jrisebo

Board Regular
Joined
Mar 15, 2011
Messages
222
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.
 

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
12,594
Office Version
  1. 2007
Platform
  1. Windows
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
 

Watch MrExcel Video

Forum statistics

Threads
1,122,893
Messages
5,598,712
Members
414,254
Latest member
MarieCo

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
Top