+ Reply to Thread
Results 1 to 2 of 2

Conditional Format if data present

  1. #1
    Registered User
    Join Date
    05-27-2004
    Posts
    23

    Conditional Format if data present

    I have a sheet2 that populates from data entered in sheet1. I would like to put borders around the data in sheet2 only if there is data (text) present (is not null) and no borders on cells with no data.

    Thanks!

  2. #2
    Forum Contributor
    Join Date
    11-09-2004
    Posts
    451
    try this macro

    Sub Macro2()
    Dim a As Variant
    Cells.Select
    Range("a3").Activate
    Selection.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
    :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
    False).Activate
    a = ActiveCell.Address
    Cells.Select
    Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlNotEqual, _
    Formula1:="=" & a
    With Selection.FormatConditions(1).Borders(xlLeft)
    .LineStyle = xlContinuous
    .Weight = xlThin
    .ColorIndex = xlAutomatic
    End With
    With Selection.FormatConditions(1).Borders(xlRight)
    .LineStyle = xlContinuous
    .Weight = xlThin
    .ColorIndex = xlAutomatic
    End With
    With Selection.FormatConditions(1).Borders(xlTop)
    .LineStyle = xlContinuous
    .Weight = xlThin
    .ColorIndex = xlAutomatic
    End With
    With Selection.FormatConditions(1).Borders(xlBottom)
    .LineStyle = xlContinuous
    .Weight = xlThin
    .ColorIndex = xlAutomatic
    End With
    Range("a1").Select
    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