Auto borders for different size data imports

Aeafa

New Member
Joined
Aug 31, 2016
Messages
12
Office Version
  1. 2010
  2. 2007
Platform
  1. Windows
Hiya!

I have a macro that imports a set of data from a .txt report each day.
But I require the data to have all borders around the cells of data.
The only problem is that the data changes each day, so sometimes it could be 34 rows x 7 columns and other days it could be 102 rows x 7 columns. (just as an example)

How would I write it into the macro to put borders around all cells containing data??
I am so stuck!!

Thank you so so much in advance. :)
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Possibly:-
Code:
Cells.Borders.LineStyle = xlNone
UsedRange.Borders.Weight = 2
 
Upvote 0
Solution
Thank you so so much! It worked fantastically. I really very much appreciate this. :D
 
Upvote 0

Forum statistics

Threads
1,214,611
Messages
6,120,513
Members
448,967
Latest member
screechyboy79

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