Results 1 to 6 of 6

Border code help.

Threaded View

  1. #1
    Forum Contributor
    Join Date
    09-05-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    212

    Border code help.

    I have a code here that partially work.
    I like to have border for the columns.
    Also like borders for rows as a group, not all.
    Coding will delete/refresh because list gets updated.
    Sub Button1_Click()
        Range("A3").Select
        x = Selection.Value
        myLastRow = Selection.End(xlDown).Row + 1
        Range("A3:A" & myLastRow).Select
            Selection.Borders(xlDiagonalDown).LineStyle = xlNone
            Selection.Borders(xlDiagonalUp).LineStyle = xlNone
            Selection.Borders(xlEdgeLeft).LineStyle = xlNone
            Selection.Borders(xlEdgeTop).LineStyle = xlNone
            Selection.Borders(xlEdgeBottom).LineStyle = xlNone
            Selection.Borders(xlEdgeRight).LineStyle = xlNone
            Selection.Borders(xlInsideVertical).LineStyle = xlNone
            Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
        
        For Each cell In Selection
            If cell.Value = x Then
                'nothing
            Else
                With cell.Offset(-1, 0).Borders(xlEdgeBottom)
                    .LineStyle = xlContinuous
                    .ColorIndex = 0
                    .TintAndShade = 0
                    .Weight = xlThin
                End With
                x = cell.Value
            End If
        Next cell
    End Sub
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Add top and bottom border to existing code
    By guitarsweety in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-13-2014, 01:55 PM
  2. Code: Cell Border
    By walid66 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-05-2010, 11:45 AM
  3. Code for Cell border styling
    By namz in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 06-03-2008, 01:47 AM
  4. Border cells with less code?
    By XP in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-24-2006, 02:10 PM
  5. Code or function for border
    By tawnee jamison in forum Excel General
    Replies: 0
    Last Post: 04-11-2005, 11:23 AM

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