If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.
I have a massive amount of feedback data from a simulation machine that needs to be reorganized. In order to do this efficiently, I need a macro that will select every 24th cell within a column from a relative reference point. This task would need to be done on an infinite loop. I have tried the "record macro" functions in Excel 2007 have been unsuccessful. The macro I tried was...
Code:
Do Until ActiveCell.Value = ""
ActiveCell.Offset(1, 0).Range("A1,A25").Select
ActiveCell.Offset(25, 0).Range("A1").Activate
Loop
End Sub
However, this macro didn't actually activate every 24th cell (I'm not entirely sure what it did if it did anything). If someone could provide me with the code for a macro that would accomplish the aforementioned tasks I would really appreciate it.
Thanks.
Last edited by Othelloguy; 07-04-2009 at 09:51 PM.
Dim rng As Range: Set rng = ActiveCell
Dim rngUnion As Range: Set rngUnion = ActiveCell
Set rng = rng.Offset(24, 0)
Do While Len(rng.Value) > 0
Set rngUnion = Union(rngUnion, rng)
Set rng = rng.Offset(24, 0)
Loop
rngUnion.Select
Possible reasons why it might not work:
(1) I don't know how many components a multiple range is allowed to have, so perhaps the table could be too large for it to be possible to select every 24th cell?
(2) If your data extends right to the bottom of the sheet then presumably "rng.Offset(24, 0)" will cause an error at some point.