Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm struggling with a simple UDF (it might require 2). I'd
like to return TRUE/FALSE if a cell has a top *or* bottom border. Something like: Function IsBorder(cell As Range) As Boolean IsBorder = cell.Borders(xlEdgeTop) End Function Thanks! Jason |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Jason,
Try something like Function HasBorder(Rng As Range) As Boolean If Rng.Borders(xlEdgeTop).LineStyle < xlNone Or _ Rng.Borders(xlEdgeBottom).LineStyle < xlNone Then HasBorder = True Else HasBorder = False End If End Function -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Jason Morin" wrote in message ... I'm struggling with a simple UDF (it might require 2). I'd like to return TRUE/FALSE if a cell has a top *or* bottom border. Something like: Function IsBorder(cell As Range) As Boolean IsBorder = cell.Borders(xlEdgeTop) End Function Thanks! Jason |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Function Isborder(cell As Range) as Boolean Dim bTop As Boolean, bBottom As Boolean Application.Volatile bTop = True bBottom = True With cell.Borders(xlEdgeTop) If .Weight = 2 And .LineStyle = -4142 _ And .ColorIndex = -4142 Then bTop = False End If End With With cell.Borders(xlEdgeBottom) If .Weight = 2 And .LineStyle = -4142 _ And .ColorIndex = -4142 Then bBottom = False End If End With Isborder = bTop Or bBottom End Function -- Regards, Tom Ogilvy "Jason Morin" wrote in message ... I'm struggling with a simple UDF (it might require 2). I'd like to return TRUE/FALSE if a cell has a top *or* bottom border. Something like: Function IsBorder(cell As Range) As Boolean IsBorder = cell.Borders(xlEdgeTop) End Function Thanks! Jason |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
border on last cell of page effects border on beginning cell of ne | Excel Discussion (Misc queries) | |||
Detect Cell Colour | Charts and Charting in Excel | |||
How to detect characters with a cell? | Excel Discussion (Misc queries) | |||
Changing the border of one cell s/n change the border of adjacent | Excel Discussion (Misc queries) | |||
Detect when Active Cell Changes | Excel Programming |