how to deal with offset

bhandari

Active Member
Joined
Oct 17, 2017
Messages
359
[TABLE="width: 128"]
<colgroup><col width="64" span="2" style="width:48pt"> </colgroup><tbody>[TR]
[TD="width: 64"]A[/TD]
[TD="width: 64, align: right"]14[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD="align: right"]16[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD="align: right"]68[/TD]
[/TR]
[TR]
[TD]D[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]E[/TD]
[TD="align: right"]32[/TD]
[/TR]
[TR]
[TD]F[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD]G[/TD]
[TD="align: right"]25[/TD]
[/TR]
[TR]
[TD]H[/TD]
[TD="align: right"]55[/TD]
[/TR]
</tbody>[/TABLE]
Code:
Sub using_the_resize_property_to_change_thesizeofRangeMethod1()
Set Rng = Range("B1:B15").Find(what:="0", lookat:=xlWhole, LookIn:=xlValues)
Rng.Offset(, -1).Resize(, 2).Interior.ColorIndex = 15
End Sub
i want D=0 should have color
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Bhandari,

Here is an updated macro for you to try:

Rich (BB code):
Sub using_the_resize_property_to_change_thesizeofRangeMethod1_V2()
' hiker95, 10/28/2017, ME1029095
Dim Rng As Range
Set Rng = Range("B1:B15").Find(what:="0", lookat:=xlWhole, LookIn:=xlValues)
Rng.Offset(, -1).Resize(, 2).Interior.ColorIndex = 15
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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