borderAround optional parameters

par60056

Well-known Member
Joined
Jul 26, 2012
Messages
1,581
Office Version
  1. 2011
  2. 2010
Platform
  1. Windows
  2. MacOS
I looked at the documentation for Range().BorderAround and it is unclear what it does if you leave out the optional parameters.

The reason for this post is informational.

Excel 2011 (mac) behaves differently from Excel 2010 (Windows). The mac alters the linestyle, weight and color and sets them to the default xlcontinuous, xlthin and black. Excel 2010 leaves them with the current values.

I was writing something to make a simple wall calendar. I set the color and weight on the borders collection for the entire area I was going to use. The I selected smaller ranges and said borderaround. This worked fine on the PC but on the mac all the color and weight reset.
 
Still, now that you are aware of the differences, simply use conditional formatting to accommodate the slightly different behavior. Whether one side has it “right” and the other side has it “wrong” doesn’t really matter. As a programmer, you just program for the difference and get on with your life. Because of possible complications with existing code, I doubt Microsoft would change either platform’s behavior even if we reported this as a bug on the Windows side.

If you look at the original post, I said:

The reason for this post is informational.

I had the solution I was just trying to make other people aware.

I don't know why I would use conditional coding. Since 1 way works on both and 1 way doesn't, I would just always use the way that works on both. Or even easier I can just put the parameters for the color and thickness on the call to borderAround and not have to worry about it.

As a programmer I try to avoid making code that is hard to maintain by having different routines to do the same thing when having 1 will work just fine. As a programmer I try to share the information so that somebody else can see that a solution was already found.

Thank you for trying to help solve a problem that I had already solved.
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top