ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cell Manipulation (https://www.excelbanter.com/excel-programming/311978-cell-manipulation.html)

Cr4z3[_2_]

Cell Manipulation
 

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.


--
Cr4z3
------------------------------------------------------------------------
Cr4z3's Profile: http://www.excelforum.com/member.php...o&userid=14864
View this thread: http://www.excelforum.com/showthread...hreadid=264933


Dana DeLouis[_3_]

Cell Manipulation
 
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"

--
Dana DeLouis
Win XP & Office 2003


"Cr4z3" wrote in message
...

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.


--
Cr4z3
------------------------------------------------------------------------
Cr4z3's Profile:
http://www.excelforum.com/member.php...o&userid=14864
View this thread: http://www.excelforum.com/showthread...hreadid=264933





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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com