Cells(Rows.Count, "b").End(xlUp).Row

  • Thread starter Thread starter Kate
  • Start date Start date
K

Kate

So, you can use the formula in the subject line (Cells(Rows.Count,
"b").End(xlUp).Row) to select the last cell in the column. But, I have
a table with a variable number of rows, which will most likely be
empty.

So instead of selecting the last cell with a value in it, I want to
select hte last cell with a border around it.

How?

Thanks
 
Will this work for you?

Sub LastBorder()
Dim myCell As String
Range("B:B").Select '<===You can change this to whatever range you
want
For Each cell In Selection
If cell.Borders(xlEdgeBottom).LineStyle = xlNone Then
GoTo fin
End If
myCell = cell.Address
Next cell
fin:
If myCell <> "" Then
Range(myCell).Select
Else
Range("B1").Select
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top