+ Reply to Thread
Results 1 to 4 of 4

how to add thick line as divider automatically

Hybrid View

  1. #1
    Registered User
    Join Date
    12-13-2011
    Location
    farmington MI
    MS-Off Ver
    Excel 2003
    Posts
    81

    Lightbulb how to add thick line as divider automatically

    I have serial number column in an excel and would like to add thick border when user goes next number.

    Please see attached file. When user goes to next level of number I want to see think border as partition between to levels. Can a macro do this?

    Appreciate your help
    var
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: how to add thick line as divider automatically

    So what are you looking for?

    For example, do you want a macro so that every time a number is added in column A, a line is placed above it covering A:K?

    Or something else?

  3. #3
    Registered User
    Join Date
    12-13-2011
    Location
    farmington MI
    MS-Off Ver
    Excel 2003
    Posts
    81

    Re: how to add thick line as divider automatically

    Exactly Steven. that is what i'm looking for..

  4. #4
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: how to add thick line as divider automatically

    I assumed that you would be adding the number manually, and not copy and pasting the numbers.

    Inside the Visual Basic Editor, click on the folder: Microsoft Excel Objects
    Click on the worksheet of your choice.
    Copy the code below into your worksheet module.

    Private Sub Worksheet_Change(ByVal Target As Range)
        If Not Intersect(Range("A:A"), Target) Is Nothing Then
            If IsNumeric(Target.Cells(1, 1)) Then
                Range("A" & Target.Row & ":K" & Target.Row).Borders(xlEdgeTop).Weight = xlMedium
            End If
        End If
    End Sub
    You can change the weight of the line to any of the following values:

    xlHairline
    xlMedium
    xlThick
    xlThin

+ 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