Increasing Target.Address

mmartinez13

New Member
Joined
Sep 1, 2011
Messages
21
I am wanting to print a label after every 8th cell is highlighted. Instead of an "IF" statement containing:

If Target.Address = "$E$9" Or If Target.Address = "$E$17" If Target.Address = "$E$25".............................. Then

How can I accomplish this without having to enter the ridiculous amount of "Or" statements?
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Welcome to the board..
Try
Rich (BB code):
If Not Intersect(Target, Range("E:E")) Is Nothing Then
    If (Target.Row - 1) Mod 8 = 0 Then
        'code here
    End If
End If

Hope that helps
 
Upvote 0
Sorry, let me change what I meant to type.

I currently have this:

If Target.Address = "$E$9" Or Target.Address = "$E$17" Or Target.Address = "$E$25" Or Target.Address = "$E$9" Then

After E9 is highlighted, I print a label. What I would like is when cells E17, E25, E33, E41, E49,............. I would like labels printed also.

Basically my users are scanning data which enters cells in columns A through E. Once the data is scanned in cell E, I return back to cell A. Once I get to E9, I want to print a label. Once I get to E17, I want to print a label, and every 8th cell down the column.

If you can't tell, I am quite the beginner. Thanks for all the replies/help. You guys are great.
 
Upvote 0

Forum statistics

Threads
1,224,582
Messages
6,179,670
Members
452,936
Latest member
anamikabhargaw

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