Excel VBA - Borders

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video we'll learn how to apply borders to particular cells so if you want to apply some borders using a macro how we do it without macros using this excel it is very easy but if you want to automate a task every now and then if you use it how do we work on that so let's see that now if you see I've created a sheet as G borders G underscore borders and the same excel file Excel VB I have written some text in a 1 to a 10 I want to apply borders from a 1 to a 10 so what is the method I can use ok borders I mean to say in this font group if you see that there's a Fahd that is a borders which are given here this is the different borders if I want to apply I want to change the width of that orokin seeis weight of the border the color of the border or I want to change the style of the border how do I do that so I'll just go back and yep let's see now so what I'll do is I'll open the VBA editor alright so in this video editor I've created G underscore borders there's one model which I've created and have written as sub borders ok you want you change the name and have written some text here some statements in the macro part but let me explain you with one example then I'll come and show you this in the entire data what I have written here so how do I want to apply a border first thing is select the area on which you want to apply the border so my area is a 1 to a 10 dot what do you want to do with that range I want to apply a border so just type your s borders okay dot what do you want do you want color line style or do you want weight what do you want exactly so if you see the first option is given as color and if you see the last option is given as line style if you go down and if you see there's given us weight value and so on so let us see I'll say the first thing is I want the color okay press tab and there are total eight types of colors into your VB macros 8 standard colors so I'll type as VB red okay or I killed as VB green okay that is one thing again if you want I can just say yes range a 1 to a 10 sorry range a 1 to a 10 dot borders oricon CSU got borders dot weight dot weight equal to let's say three I have again the weight the weight is only till for maximum for apart from that you cannot use it right now let's say what happen is if I go back again if I want to add some style line style so what I'll do is a 1 to a 10 dot borders dot line style okay and I can give us Excel and I have to type s dot so what I've done is I have written here as line style equal to X Excel dot so there are many line styles given excel dot excel - and so on so once I execute step by step observe what will happen I hope you able to see that so once I execute you can see and if I press f8 from my keyboard you see f8 so observe here the line cell will come here f8 from my keyboard yeah I see I've got the dotted line that is Excel dot second thing is I want dot color as VB green so when I press f8 this color automatically changes to green color now again I'll press f8 if you observe the weight of this line would be s3 earlier it was not that weight now it has become as three similarly I have executed I have written some few macros I'll try to bring that up I'll just delete that and bring up so you can see that so I have worked on this macros what I'm trying to do is same borders dot line style everywhere dot excel dot dash continuous double and none so all this none will remove all the lines all the borders and if you want dotted line - line continuous line basically there are many line styles I have selected only a few of them if I press f8 from my keyboard I'll use better this one so that you can see both of them yeah so right now it is dot line if you see here that's a dot line again if I again click on step into it is a dashed line step into continuous line you observe here it's going on continuous line so after this it will be continuous line now there is a continuous line yeah next is the double line if I again click on the step into excel double this one is W if you want to remove all the borders whatever is given here you just type as Excel none and all the borders will be removed f8 or you can sisters so I hope you see all the borders line have been gone away right and finally I'll just press if a f8 so it ends the execution part right so I hope able to understand how do you apply borders to yourselves to your text okay when it comes in with the help of macros without macros it is very easy but sometimes you want to automate the tasks that time macros are useful I hope you have understood that's all for this video
Info
Channel: Tutorialspoint
Views: 192,789
Rating: undefined out of 5
Keywords: VBA, Marcos, Microsoft, Excel VBA, Excel VBA - Borders, Borders
Id: 5pp1r1sQKtg
Channel Id: undefined
Length: 4min 32sec (272 seconds)
Published: Mon Jan 15 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.