|
-
Nov 5th, 2009, 08:22 PM
#1
Thread Starter
Addicted Member
[RESOLVED] Cell borders
I've been trying to retrieve the number of borders a cell has using:
selection.Borders.Value
which gives the following results:
- if the cell has no border you get -4142
- if the cell has a complete border (4 lines) you get 1
- if the cell has from 1 to 3 lines you get Null
How can I identify if the cell only has, for example, one upper border and one left border? etc...
-
Nov 5th, 2009, 08:39 PM
#2
Re: Cell borders
How can I identify if the cell only has, for example, one upper border and one left border? etc...
Code:
Sub Sample()
With Range("E5") '<~~ Change this to relevant cell
'~~> Check Status of Top and LeftBorder
If .Borders(xlEdgeTop).LineStyle = 1 And _
.Borders(xlEdgeLeft).LineStyle = 1 Then
'~~> If true then check if there are any other borders
If .Borders(xlEdgeBottom).LineStyle <> 1 And _
.Borders(xlEdgeRight).LineStyle Then
MsgBox "Cell has only left and top border"
End If
End If
End With
End Sub
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|