Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How do I draw borders around a cell or range in an excel sheet?

borders CELL draw Excel range Sheet
0
Posted

How do I draw borders around a cell or range in an excel sheet?

0

‘Code by Mahipal Padigela ‘Open Microsoft Excel ‘Goto VBA Editor (Press Control+F11 or navigate Menu Tools–>Macro–>Visual BAsic Editor) ‘Insert a Module (Right click your file name in the VB editor–>Insert–>Module) ‘Paste the following code into the Module1 Sub DrawBorders() Dim strRng1 As String Dim strRng2 As String strRng1 = “A5:D10” ‘set some test range strRng2 = “C16:G20” ‘set some test range ‘If you need to draw all the borders with same properties, use this ActiveSheet.Range(strRng1).BorderAround xlContinuous, xlMedium, 46 ‘Or if you need to draw the borders individually, applying different properties to each, use this ActiveSheet.Range(strRng2).Borders(xlEdgeLeft).LineStyle = xlContinuous ActiveSheet.Range(strRng2).Borders(xlEdgeLeft).ColorIndex = 4 ActiveSheet.Range(strRng2).Borders(xlEdgeTop).LineStyle = xlContinuous ActiveSheet.Range(strRng2).Borders(xlEdgeTop).ColorIndex = 3 ActiveSheet.Range(strRng2).Borders(xlEdgeBottom).LineStyle = xlContinuous ActiveSheet.Range(strR

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123