All Borders equivalent in Excel for a range

17,094

I don't know a more efficient way than this.

With Range("A1:R780")
    .Borders(xlInsideVertical).LineStyle = xlContinuous
    .Borders(xlInsideHorizontal).LineStyle = xlContinuous
    .BorderAround xlContinuous
End with

Tough I belive this would also work.

Range(“A1:R780").Borders.LineStyle = xlContinuous 
Share:
17,094

Related videos on Youtube

Crazyd
Author by

Crazyd

Access/VBA pro & SQL Newbie

Updated on September 18, 2022

Comments

  • Crazyd
    Crazyd almost 2 years

    I would think there is a way in VBA to put the 4 wall borders for every cell in a range, but I have yet to figure out or find one. Basically I want a range such as (A1:R780) to all have their own square.

    • Musselman
      Musselman over 8 years
    • Crazyd
      Crazyd over 6 years
      Simpler question didn't look on Stack Over Flow due to not really a programming question as I see it.
  • Crazyd
    Crazyd over 8 years
    Thanks I actually found a much more complex way of doing it.... probably 10 minutes before you answered... just now checked to see if there was an easier way... I basically had 6 Commands to do the same basic thing. The second one didn't work, but the with Range did work.