Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 152
Default simple loop needed please

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


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,533
Default simple loop needed please

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" skrev i meddelelsen
...
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


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
Simple formula needed shane Excel Discussion (Misc queries) 5 October 18th 07 11:27 PM
I need a simple loop with a 4+ row added in. pgarcia Excel Discussion (Misc queries) 5 July 19th 07 07:42 PM
Another simple formula needed Connie Martin Excel Worksheet Functions 6 May 25th 06 04:35 PM
Help needed in a simple task vmantrana Excel Discussion (Misc queries) 3 April 18th 06 12:57 AM
simple (i think) UDF debug help needed Adam Kroger Excel Discussion (Misc queries) 4 December 18th 05 08:11 PM


All times are GMT +1. The time now is 07:17 AM.

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

About Us

"It's about Microsoft Excel"