Draw thick borders according (in the area) as per list parameters

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Will post again
Hello,</SPAN></SPAN>

I got a list in the column M that has a Start row number & in the column N that has an End row number </SPAN></SPAN>

I need to draw thick borders in the area columns C:J as per row numbers are listed in column M:N </SPAN></SPAN>

As I am not able to post only borders so i have filled the colour in the area I need to draw the think borders</SPAN></SPAN>
C6:J15</SPAN></SPAN>
C16:J24</SPAN></SPAN>
C25:J33</SPAN></SPAN>
C34:J44</SPAN></SPAN>
C45:J51 and so on as per list </SPAN></SPAN>

In the following example shown only 5 borders but I need to draw all rows find in the list</SPAN></SPAN>


Book1
ABCDEFGHIJKLMNOP
1
2
3
4
5Start Row NumEnd Row Num
6615
71624
82533
93444
104551
1152100
12101122
13123167
14168190
15191205
16206290
17291455
18456570
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
Sheet2


Thank you all</SPAN></SPAN>

Excel 2000</SPAN></SPAN>
Regards,</SPAN></SPAN>
Moti</SPAN></SPAN>
 
Upvote 0
How about
Code:
Sub AddBorders()
   Dim Cl As Range
   
   For Each Cl In Range("N6", Range("N" & Rows.Count).End(xlUp))
      Range("C" & Cl).Resize(Cl.Offset(, 1) - Cl + 1, 8).BorderAround , xlMedium
   Next Cl
End Sub
 
Upvote 0
Try this:-
Code:
[COLOR="Navy"]Sub[/COLOR] MG16Oct55
[COLOR="Navy"]Dim[/COLOR] Rng [COLOR="Navy"]As[/COLOR] Range, Dn [COLOR="Navy"]As[/COLOR] Range
[COLOR="Navy"]Set[/COLOR] Rng = Range("M6", Range("M" & Rows.Count).End(xlUp))
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Dn [COLOR="Navy"]In[/COLOR] Rng
    Range("C" & Dn.Value & ":J" & Dn.Offset(, 1).Value).BorderAround Weight:=xlThick
[COLOR="Navy"]Next[/COLOR] Dn
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0
Oops, I'm looking at the wrong column, it should be
Code:
Sub AddBorders()
   Dim Cl As Range
   
   For Each Cl In Range("M6", Range("M" & Rows.Count).End(xlUp))
      Range("C" & Cl).Resize(Cl.Offset(, 1) - Cl + 1, 8).BorderAround , xlMedium
   Next Cl
End Sub
 
Upvote 0
Oops, I'm looking at the wrong column, it should be
Code:
Sub AddBorders()
   Dim Cl As Range
   
   For Each Cl In Range("M6", Range("M" & Rows.Count).End(xlUp))
      Range("C" & Cl).Resize(Cl.Offset(, 1) - Cl + 1, 8).BorderAround , xlMedium
   Next Cl
End Sub
Thank you Fluff, it worked perfect </SPAN></SPAN>

Have a nice day</SPAN></SPAN>

Kind Regards,</SPAN></SPAN>
Moti</SPAN></SPAN>
 
Upvote 0
Try this:-
Code:
[COLOR=navy]Sub[/COLOR] MG16Oct55
[COLOR=navy]Dim[/COLOR] Rng [COLOR=navy]As[/COLOR] Range, Dn [COLOR=navy]As[/COLOR] Range
[COLOR=navy]Set[/COLOR] Rng = Range("M6", Range("M" & Rows.Count).End(xlUp))
[COLOR=navy]For[/COLOR] [COLOR=navy]Each[/COLOR] Dn [COLOR=navy]In[/COLOR] Rng
    Range("C" & Dn.Value & ":J" & Dn.Offset(, 1).Value).BorderAround Weight:=xlThick
[COLOR=navy]Next[/COLOR] Dn
[COLOR=navy]End[/COLOR] [COLOR=navy]Sub[/COLOR]
Regards Mick
Thank you Mick, it worked as request perfect</SPAN></SPAN>

Have a nice day</SPAN></SPAN>

Kind Regards,</SPAN></SPAN>
Moti</SPAN></SPAN>
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,876
Members
452,363
Latest member
merico17

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