Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default 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.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default 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.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Use a string as a Variable Name Brandt Excel Worksheet Functions 4 November 28th 07 06:01 PM
Variable in string DevinC Excel Discussion (Misc queries) 5 January 26th 06 08:59 PM
setting a range variable equal to the value of a string variable Pilgrim Excel Programming 2 July 1st 04 11:32 PM
How do I convert an integer variable to a string variable? dumbass Excel Programming 2 May 21st 04 07:34 PM
Join string with variable name to get variable value Dianne Excel Programming 6 February 12th 04 04:24 AM


All times are GMT +1. The time now is 03:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"