Hey everyone, i'm puzzled :-S
Is it possible to write a macro that will place borders around any cell with text in it, while leaving empty cells un-bordered.
any help very much appreciated,
noviceNBAuser
Hey everyone, i'm puzzled :-S
Is it possible to write a macro that will place borders around any cell with text in it, while leaving empty cells un-bordered.
any help very much appreciated,
noviceNBAuser
ok, had a think and I reckon conditional formatting is the easiest solution: I'm stuck in macro writting mode you see :-)
thx anyways ppl :-)
(p.s. still stuck on my text as a trigger for macro problem though - ref to earlier post. cheers)
Hello Joule,
Placing a Border Around a Cell:
Range("A1").BorderAround LineStyle:= xlBorderLineStyleContinuous, Weight:= xlThin
Placing a Border Around a Range of Cells:
Range("A1:D10").BorderAround LineStyle:= xlBorderLineStyleContinuous, Weight:= xlThin
LineStyle Constants
xlBorderLineStyleNone
xlBorderLineStyleContinuous
xlBorderLineStyleDash
xlBorderLineStyleDot
xlBorderLineStyleDouble
Weight Constants
xlHairline
xlThin
xlMedium
xlThick
Note: To remove the borders, set LineStyle = xlBorderLineStyleNone
Macro to Add Borders to Cells with Text...
_________________________________________________________________
Public Sub AddBorder(ByVal Cell_Address As String)
Dim DataType
With ActiveSheet.Range(Cell_Address)
DataType = .Value
If VarType(DataType) = 8 Then
.BorderAround = LineStyle:= xlBorderLineStyleContinuous, Weight:= xlThin
End If
End With
End Sub_________________________________________________________________
Usiing the Macro:
AddBorder ("A1")
If "A1" is a Text (Variant Type 8 = String) then add a border around the cell.
Hope this helps,
Leith Ross
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks