Offset Syntax

Danny Ray

Board Regular
Joined
May 28, 2005
Messages
79
Hello,
Can someone tell me the proper suntax to condense the following
bit of code?

Thanks.


Code:
With Target
 .Offset(0, 1).Borders.ColorIndex = 5
 .Offset(0, 2).Borders.ColorIndex = 5
 .Offset(0, 3).Borders.ColorIndex = 5
 .Offset(0, 4).Borders.ColorIndex = 5
 .Offset(0, 5).Borders.ColorIndex = 5
 .Offset(0, 6).Borders.ColorIndex = 5
 .Offset(0, 7).Borders.ColorIndex = 5
 .Offset(0, 8).Borders.ColorIndex = 5
 .Offset(0, 9).Borders.ColorIndex = 5
 .Offset(0, 10).Borders.ColorIndex = 5
 .Offset(0, 11).Borders.ColorIndex = 5
 .Offset(0, 12).Borders.ColorIndex = 5
 .Offset(0, 13).Borders.ColorIndex = 5
 .Offset(0, 14).Borders.ColorIndex = 5
 .Offset(0, 15).Borders.ColorIndex = 5
 .Offset(0, 16).Borders.ColorIndex = 5
 .Offset(0, 17).Borders.ColorIndex = 5
 .Offset(0, 18).Borders.ColorIndex = 5
 .Offset(0, 19).Borders.ColorIndex = 5
 .Offset(0, 20).Borders.ColorIndex = 5
 .Offset(0, 21).Borders.ColorIndex = 5
 .Offset(0, 22).Borders.ColorIndex = 5
 .Offset(0, 23).Borders.ColorIndex = 5
 .Offset(0, 24).Borders.ColorIndex = 5
 .Offset(0, 25).Borders.ColorIndex = 5
 .Offset(0, 26).Borders.ColorIndex = 5
 .Offset(0, 27).Borders.ColorIndex = 5
 .Offset(0, 28).Borders.ColorIndex = 5
 .Offset(0, 29).Borders.ColorIndex = 5
 .Offset(0, 30).Borders.ColorIndex = 5
 .Offset(0, 31).Borders.ColorIndex = 5
 .Offset(0, 32).Borders.ColorIndex = 5
 .Offset(0, 33).Borders.ColorIndex = 5
 .Offset(0, 34).Borders.ColorIndex = 5
 .Offset(0, 35).Borders.ColorIndex = 5
 .Offset(0, -1).Borders.ColorIndex = 5
 .Offset(0, -2).Borders.ColorIndex = 5
 .Offset(0, -3).Borders.ColorIndex = 5
 .Borders.ColorIndex = 5
 End With
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
How about:
<font face=Courier New><SPAN style="color:#00007F">Sub</SPAN> a()
X = "D4"
Range(Range(X).Offset(0, -3).Address & ":" & Range(X).Offset(0, 35).Address).Borders.ColorIndex = 5
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,429
Members
448,961
Latest member
nzskater

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