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:
Neither code is better, they are different. The 2nd one is more specific as it only works on the actual table rather than the column and so wouldn't pick out any data below the table.

Both codes work on the ActiveWorkbook, if it needs to act on a specific workbook whether Active or not then you need to specify the workbook and the sheet in the code and not use select.
Code:
Sub DownArrowZ()
Application.Goto Workbooks("TERMINAL GRUDE 2017").Sheets("ED-5").ListObjects("Table2").ListColumns(1).DataBodyRange.Find("*", , xlValues, , , xlPrevious).Offset(1)
End Sub

or (seeing by your like you prefer it short)

Code:
Sub DownArrowZ()
Application.Goto Workbooks("TERMINAL GRUDE 2017").Sheets("ED-5").ListObjects("Table2").ListColumns(1).DataBodyRange.Find("*", , -4163, , 1, 2)(2)
End Sub


BTW, please tell people when you are dealing with tables rather than just ranges as you would have got a solution much earlier if you had given full details in your post.
 
Upvote 0

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Yes, i'm so sorry, col P is part of a table. I have....another problem, i'll change the workbbok name every month, so... That Michael's solution worked on B col, a col w/o a table.

Code:
Sub upArrow()
ThisWorkbook.ActiveSheet.Range("B" & Cells(Rows.Count, "B").End(xlUp).Row + 1).Select
End Sub
 
Last edited:
Upvote 0
Questions, why would it not be the active workbook and sheet if you are running it from a button on the sheet and so why wouldn't the codes I originally posted not work?
 
Last edited:
Upvote 0
I think that ThisWorkbook.ActiveSheet would be enough!?

ActiveSheet is enough because you are running it from a button on the sheet and so the sheet is active (you do need the activesheet part because you are using a listobject).

as previously posted...

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

Forum statistics

Threads
1,215,059
Messages
6,122,913
Members
449,093
Latest member
dbomb1414

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