+ Reply to Thread
Results 1 to 2 of 2

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

  1. #1
    Kate
    Guest

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

    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


  2. #2
    Valued Forum Contributor
    Join Date
    04-11-2006
    Posts
    407
    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

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1