# Code that will repeat a fixed sequence of values every 13 rows

I have some code that relies on the value sequence 4 ...16 every 13 rows starting in the fourth row. Right now I'm accomplishing this “reset” of the iRow values with a helper range in Column G. (G17, G30, and G43 all equal 4: G18, G31, and G44 all equal 5, etc, etc.)

``````Dim iCol As Long, iRow As Long, lCel As String, rCel As String
For Each cel In Range([F4], [D10000].End(xlUp).Offset(0, 2)) '
iRow = cel.Offset(0, 1)
iCol = [AllWeeks].Find(what:=cel.Offset(0, -1), LookIn:=xlValues).Column - 1
Cells(iRow, 6).Formula = "=IFERROR(AVERAGE(" & lCel & ":" & rCel & ")/30.5*7,"""")"
Next cel
``````
However, I would like to accomplish this “reset” of the iRow values without the helper range in Column G.

How do I do that?

Thanks,
John
LVL 1
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
iRow = cel.Row Mod 13
0

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Reliability Business Tools Analyst IIAuthor Commented:
I get a value of -1 when I use that line of code. Could you please re-post with that line in its proper context within my original code?

Thanks,
John
0
Commented:
Can you post a sample workbook... That might make a difference too.
0
Reliability Business Tools Analyst IIAuthor Commented:
hi buttersk, I've gotten overwhelmed with more pressing problems at work so I'm going to assume that your suggestion will work and close the question. Sorry for the wild goose chase!

Thanks,
John
0
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.