Set borders dynamically around a range - vba

kelly mort

Well-known Member
Joined
Apr 10, 2017
Messages
2,169
Office Version
  1. 2016
Platform
  1. Windows
Hello geniuses,
I am looking for a vba script that can set borders like the image here.
The data can grow or shrink. And when it does, I want to adapt to it with the borders.

I hope someone can fix it for me.

Thanks in advance.
 

Attachments

  • AN_RECEIPT_INTERFACE.jpg
    AN_RECEIPT_INTERFACE.jpg
    87.4 KB · Views: 43
@Peter_SSs
Super awesome!
But this line
Code:
 .NumberFormat = "0.00"

Is affecting the dates. How do we eliminate the dates from its effects?
 
Upvote 0

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Is affecting the dates.
Ah, yes, sorry about that. Problem was you didn't give any sample data that we could copy so I just made up rubbish and didn't even have dates. :oops:
Leave that NumberFormat line as it is and add this one immediately below it
VBA Code:
.Cells(4, 3).Resize(Rws - 4).NumberFormat = "dd-mm-yy"
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,265
Members
452,627
Latest member
KitkatToby

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