variable string and loops
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. |
variable string and loops
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. On Wed, 27 Oct 2004 13:05:05 -0700, "Mourinho" wrote: 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. |
variable string and loops
Forgot your other question: Maybe Run/Reset is what you are after.
On Wed, 27 Oct 2004 13:05:05 -0700, "Mourinho" wrote: 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. |
All times are GMT +1. The time now is 04:56 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com