Excel 2002 - Borders(xlInsideVertical).LineStyle=xlcontinuous notworking

  • Thread starter Thread starter Yajiv
  • Start date Start date
Y

Yajiv

I have excel 2002 running in my server.
I tried to format a sheet with macro.
The
sheet.range.borderaround xlcontinuous is working
but sheet.range.borders(xlinsidevertical).linestyle=xlcontinuous is
not working
is there any other way to do the above formatting?
 
Try it using Cells; something like this...

Worksheets("Sheet1").Range("C5:F8").Cells.Borders(xlInsideVertical).LineStyle
= xlContinuous

Rick
 
I meant to add... the idea being that without "Cells", Borders refers to the
border around the specified range; with "Cells", Borders refers to the
border around individual cells within the range.

Rick
 
Hi Rick,

With your example that changes the inside borders it wouldn't make any
difference to use .Range("C5:F8").Cells.etc or .Range("C5:F8").etc.

When applying 'inside' borders each area in the range must include at least
two columns or two rows if applying vertical or horizontal borders
respectively. The four 'edge' borders and 'diagonal' borders can be applied
to any size range, even a single cell.

The OP's code and objective was somewhat vague and ambiguous, but maybe the
above explains why it is failing. Or maybe if the objective is to apply the
format to the entire sheet -

ws.Cells.Borders(xlInsideVertical).LineStyle = xlContinuous
where 'ws' is a reference to the worksheet.

Regards,
Peter T
 

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

Back
Top