Cell Manipulation

C

Cr4z3

Yeh thats how i had it originally withing the array
but i want the values to remain within these cells C11-C15 so when the
macro is run it should only be allowed to run in those cells. Now the
orginial script i had works fine if it start it at Cell C11. But if i
was to start at C12 then the list wouldnt restart from there.

Its abit like the first reply i got, If > C15 then I= C11. So it should
start the array within any of these cells, C11, C12, C13, C14, C15 and
once it reachs C15 restart back at C11.
 
D

Dana DeLouis

I'm not too sure, but does this idea work?

Sub Demo()
Dim r As Long
Dim n As Variant

n = Array("Bob", "Jim", "Jake", "Andrew", "Kim")

'// You picked a cell in C11:C15 to start
[C14].Select

r = 11 - ActiveCell.Row + 5

[C11] = n((r + 0) Mod 5)
[C12] = n((r + 1) Mod 5)
[C13] = n((r + 2) Mod 5)
[C14] = n((r + 3) Mod 5)
[C15] = n((r + 4) Mod 5)
End Sub

Where C11:C15 now contain the following with "Bob" being in C14.
"Jake", "Andrew", "Kim", "Bob", "Jim"
 

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

Top