variable string and loops

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am missing something fundamental here, but I am new to this..
It should be returning the Row No. every 7th but only returns 7, 7, 7...

Dim HderRows(1 To 5) As String
Range("B3").Select

For n = 1 To 5
HderRows(n) = ActiveCell.Offset(7, 0).Row
Next n

Also, an 'operational' question, is there a quick way to reset a sub while
de-bugging? The highlighted error tends remain even after a fix. Again,
probably missed something easy here

Thanks

M.
 
That's because you aren't changing the active cell. You don't need to select
or activate a cell to work with it.

I'm not sure what values you want to put in your array, but if it's just a
series of number that increment by 7 each time:

R = 7
For n = 1 To 5
HderRows(n) = R
R = R + 7
Next n

Note that if the series happens to be row numbers, that doesn't matter.
There's no reason to access the worksheet here.
 
Forgot your other question: Maybe Run/Reset is what you are after.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top