From: Alan on
basically

i want the macro to enter values 1 to 5 for range g2:g6
then move onto row h2:h6 and start with 2 and place i and the bottom

so it should look like this

Column G Column h Column i
1 2 3
2 3 4
3 4 5
4 5 1
5 1 2

which then i can create a bigger range from G to P


can you help, i just can't work it out i've got 1 to 5 in every row but its
not what i want


From: Per Jessen on
Hi

This should do it:

Sub aaa()
Dim StartCell As Range

Set StartCell = Range("G2")
For col = 0 To 9
MyVal = MyVal + 1
If MyVal > 5 Then MyVal = 1
For r = 1 To 5
StartCell.Offset(r, col) = MyVal
MyVal = MyVal + 1
If MyVal > 5 Then MyVal = 1
Next
Next
End Sub


Regards,
Per

"Alan" <Alan(a)discussions.microsoft.com> skrev i meddelelsen
news:726FA485-B7DA-4CC2-AB55-C10C2D2CA3A9(a)microsoft.com...
> basically
>
> i want the macro to enter values 1 to 5 for range g2:g6
> then move onto row h2:h6 and start with 2 and place i and the bottom
>
> so it should look like this
>
> Column G Column h Column i
> 1 2 3
> 2 3 4
> 3 4 5
> 4 5 1
> 5 1 2
>
> which then i can create a bigger range from G to P
>
>
> can you help, i just can't work it out i've got 1 to 5 in every row but
> its
> not what i want
>
>
 | 
Pages: 1
Prev: Plotting
Next: Excel and SQL Server