Reputation: 1285
I have a range sh.Range("F46:I46")
that currently has a thin bottom border that I want to get rid of using VBA, yet the solutions I've tried have failed to work. Right now all I have is:
sh.Range("F46:I46").Borders(xlEdgeBottom).LineStyle = xlNone
I've also tried:
For Each r In sh.Range("F46:I46")
r.Borders(xlEdgeBottom).LineStyle = xlNone
Next r
...which is effectively the same thing, found here, and I've also tried:
sh.Range("F46:I46").Borders.LineStyle = Excel.XlLineStyle.xlLineStyleNone
...which I think is a VB.net code found here.
Where am I going wrong????? Thanks!
Upvotes: 0
Views: 1752
Reputation: 1285
I found out what made it work. I just used:
sh.Range("F46:I48").Borders.LineStyle = xlNone
...without specifying xlEdgeBottom
in the Borders function, and expanding the range a bit, so whatever "border" was being applied near my range was not of the xlEdgeBottom type. This command just removed them all.
Also, another solution that worked was just to apply a Normal cell style to the range in question, using:
sh.Range("F46:I48").Style = "Normal"
Thanks everyone!
Upvotes: 2