A Borders question

S

Stuart

Why might the following not be removing the Right border,
please?

If C.Value = SEARCHFOR Then
C.Offset(-1, -2) _
.Borders(xlEdgeRight).LineStyle = xlNone

Regards.
 
B

Bob Phillips

Stuart,

This works for me

If c.Value = "SEARCHFOR" Then _
c.Offset(-1, -2) _
.Borders(xlEdgeRight).LineStyle = xlNone

that is, looking for the text SEARCHFOR, so in quotes, and a continuation
mark after Then as you have no EndIf. Also, c needs to be a range object.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
S

Stuart

Didn't post with all relevent information, sorry.
I have:

Const SEARCHFOR As Variant = "£"
Dim ws As Worksheet, C As Range
and

For Each C In Intersect(Range("F:F"), ActiveSheet.UsedRange)
If C.Value = SEARCHFOR Then
C.Offset(-1, -2) _
.Borders(xlEdgeRight).LineStyle = xlNone
End If
Next

Your confirmation made me look elsewhere.....
should have been:

For Each C In Intersect(.Range ie a Full stop/Period
was missing.

Regards and thanks.
 
S

steve

Stuart,

Keep in mind that one cells right border is the next cells left border.
Visually they look the same...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top