vba Clearcontents for even row only in a range

gtd526

Well-known Member
Joined
Jul 30, 2013
Messages
660
Office Version
  1. 2019
Platform
  1. Windows
Hello,
VBA - How to clearcontents for even row only in a specific range?
Thanks.
NFL.xlsm
AB
2TeamsATS
3
4KC-4
5LAC4
6CAR
7BUF0
8LVR6
9CLE-6
10NE2.5
11IND-2.5
12NYJ10
13MIA-10
14WAS5
15PHI-5
Weekly Picks
Cell Formulas
RangeFormula
B5,B15,B13,B11,B9,B7B5=IF(ISTEXT(A4),IF(B4="PK","PK",IF(B4<0,B4*-1,B4*-1)),"")
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
You could try the methods below

VBA Code:
Sub jec()
 With Cells(4, 1).CurrentRegion
   .Value = Evaluate(Replace(Replace("if(mod(if(%%>0,%%,1),2)=0,"""",&&)", "%%", .Columns(2).Address), "&&", .Address))
 End With
End Sub


VBA Code:
Sub jecc()
 Dim ar As Variant, it As Variant
 Set ar = Cells(1, 99)
 
 For Each it In Cells(4, 1).CurrentRegion.Columns(2).Cells
   If it.Value > 0 And it.Value Like "*[24680]" Then Set ar = Union(ar, it.Offset(, -1).Resize(, 2))
 Next
 
 ar.ClearContents
End Sub
 
Upvote 0
You could try the methods below

VBA Code:
Sub jec()
 With Cells(4, 1).CurrentRegion
   .Value = Evaluate(Replace(Replace("if(mod(if(%%>0,%%,1),2)=0,"""",&&)", "%%", .Columns(2).Address), "&&", .Address))
 End With
End Sub


VBA Code:
Sub jecc()
 Dim ar As Variant, it As Variant
 Set ar = Cells(1, 99)
 
 For Each it In Cells(4, 1).CurrentRegion.Columns(2).Cells
   If it.Value > 0 And it.Value Like "*[24680]" Then Set ar = Union(ar, it.Offset(, -1).Resize(, 2))
 Next
 
 ar.ClearContents
End Sub
Thank you.
 
Upvote 0

Forum statistics

Threads
1,215,651
Messages
6,126,027
Members
449,281
Latest member
redwine77

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