Find first empty cell in row range-VBA

ljubo_gr

Board Regular
Joined
Dec 6, 2014
Messages
244
Office Version
  1. 2016
Platform
  1. Windows
=Happy+New(Year(2017))

I have three sheets, they have columns A&B, ranges A2:A100, B2:B100. "A" range will always be shorter than B, if that means something. I need vba code to move my selector to First free cell in sheet1 "A"range, another code for "B"range, then another codes for Sheet2...Sheet3.
Thanks in advance kind people!
 
Last edited:
so you are not actually looking for a blank cell in a set of data, simply the next available cell...is that correct ???
 
Upvote 0

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
so you are not actually looking for a blank cell in a set of data, simply the next available cell...is that correct ???

Yes, Michael, Columns named "DATUM" Date, will always have value, yes, i want jump to First available cell(row)
 
Upvote 0
Gee, I wish we had known that earlier.......

Code:
Sub upArrow()
ThisWorkbook.ActiveSheet.Range("B" & Cells(Rows.Count, "B").End(xlUp).Row + 1).Select
End Sub

Sub DownArrow()
ThisWorkbook.ActiveSheet.Range("B" & Cells(Rows.Count, "P").End(xlUp).Row + 1).Select
End Sub
 
Upvote 0
I'm unable to test this, i don't have workbook on HDD, will test tomorrow at work, THANKS MICHAEL M, GOD BLESS!
 
Upvote 0
Michael, B column is working, now the problem is P column, it won't jump to first free cell, it jumps to the end of table!?
Thanks so much,
 
Upvote 0
Code:
Sub DownArrow()
ThisWorkbook.ActiveSheet.Range("[COLOR=#ff0000][FONT=arial]P[/FONT][/COLOR]" & Cells(Rows.Count, "P").End(xlUp).Row + 1).Select
End Sub

just change "B" to "P"
 
Upvote 0
Try
Code:
Sub DownArrowX()
Dim lr As Long
lr = ThisWorkbook.ActiveSheet.Range("P:P").Find(what:="*", SearchOrder:=xlRows, SearchDirection:=xlPrevious, LookIn:=xlValues).Row
ThisWorkbook.ActiveSheet.Range("P" & lr + 1).Select
End Sub
 
Last edited:
Upvote 0
Or if brevity is important to you then as a one-liner try

Code:
Sub DownArrowZ()
ActiveSheet.ListObjects("Table2").ListColumns(1).DataBodyRange.Find("*", , xlValues, , , xlPrevious).Offset(1).Select
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,375
Messages
6,124,576
Members
449,173
Latest member
Kon123

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