+ Reply to Thread
Results 1 to 5 of 5

Macro to border row from start column to end column

  1. #1
    Forum Contributor
    Join Date
    06-10-2005
    Location
    Central Jersey
    Posts
    117

    Arrow Macro to border row from start column to end column

    I want to create a macro where if a value is entered in column "B", then I want the row (from Column A to G) that the value was entered in to be bordered with a thin outline and thin inside lines.

    BUT, if a value in column "B" is deleted, then I want the border removed in that row from column "A" to "G".

    I would use conditional formatting but I've used them up for other criterias.
    This will also perform upon every change in the worksheet...so please don't forget:

    Private Sub WorkSheet_Change(ByVal Target As Excel.Range)


    I'm still a novice at VBA, but I'm trying to make a macro right now that does this.


    Thanks in advance.
    -Joseph

  2. #2
    Jim Thomlinson
    Guest

    RE: Macro to border row from start column to end column

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Column = 2 Then
    If Target.Value = Empty Then
    Range(Target.Offset(0, -1), Target.Offset(0,
    5)).Borders.LineStyle = xlNone
    Else
    Range(Target.Offset(0, -1), Target.Offset(0, 5)).Borders.Weight
    = xlThin
    End If
    End If
    End Sub
    --
    HTH...

    Jim Thomlinson


    "malik641" wrote:

    >
    > I want to create a macro where if a value is entered in column "B", then
    > I want the row (from Column A to G) that the value was entered in to be
    > bordered with a thin outline and thin inside lines.
    >
    > BUT, if a value in column "B" is deleted, then I want the border
    > removed in that row from column "A" to "G".
    >
    > I would use conditional formatting but I've used them up for other
    > criterias.
    > This will also perform upon every change in the worksheet...so please
    > don't forget:
    >
    > Private Sub WorkSheet_Change(ByVal Target As Excel.Range)
    >
    >
    > I'm still a novice at VBA, but I'm trying to make a macro right now
    > that does this.
    >
    >
    > Thanks in advance.
    >
    >
    > --
    > malik641
    >
    >
    > ------------------------------------------------------------------------
    > malik641's Profile: http://www.excelforum.com/member.php...o&userid=24190
    > View this thread: http://www.excelforum.com/showthread...hreadid=389185
    >
    >


  3. #3
    Forum Contributor
    Join Date
    06-10-2005
    Location
    Central Jersey
    Posts
    117
    Hey Jim, thanks a lot! Macro works flawlessly!!!

  4. #4
    Forum Contributor
    Join Date
    06-10-2005
    Location
    Central Jersey
    Posts
    117
    Now I have another question...
    The macro won't work for one of my workbooks. The workbook collects data from another workbook (i.e. =[Workbook1.xls]Sheet1! type) and I ALSO want this workbook to have the macro work the same way...but it won't.

    How do I make this macro work for this workbook?

  5. #5
    Forum Contributor
    Join Date
    06-10-2005
    Location
    Central Jersey
    Posts
    117
    anyone?????

+ 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