Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub MyNext()
For X = 1 To 10 Step 1 For Y = 1 To 40 Step 4 Range("A" & Y) = X & "Words" Next Y Next X End Sub Y iterates OK but X never gets a look in?? -- donwb |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
What are you expecting it to do because (probably infuriatingly for you)it
is doing ecactly what you are telling it to do which is Write "1WORDS" to a1, A5 down to A37 The 1 comes from the X loop and words from the Y loop The macrow then overwrites each of these cells with 2Words, 3words etc up to 10Words. Mike "donbowyer" wrote: Sub MyNext() For X = 1 To 10 Step 1 For Y = 1 To 40 Step 4 Range("A" & Y) = X & "Words" Next Y Next X End Sub Y iterates OK but X never gets a look in?? -- donwb |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Mike
Yes I agree. What I would like it to do is put "1Word" in Cell A1, then "2Word" in cell A5, then "3Word" in A9 etc Don -- donwb "Mike H" wrote: What are you expecting it to do because (probably infuriatingly for you)it is doing ecactly what you are telling it to do which is Write "1WORDS" to a1, A5 down to A37 The 1 comes from the X loop and words from the Y loop The macrow then overwrites each of these cells with 2Words, 3words etc up to 10Words. Mike "donbowyer" wrote: Sub MyNext() For X = 1 To 10 Step 1 For Y = 1 To 40 Step 4 Range("A" & Y) = X & "Words" Next Y Next X End Sub Y iterates OK but X never gets a look in?? -- donwb |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try this
Sub MyNext() x = 1 For Y = 1 To 40 Step 4 Range("A" & Y) = x & "Words" x = x + 1 Next End Sub Mike "donbowyer" wrote: Hi Mike Yes I agree. What I would like it to do is put "1Word" in Cell A1, then "2Word" in cell A5, then "3Word" in A9 etc Don -- donwb "Mike H" wrote: What are you expecting it to do because (probably infuriatingly for you)it is doing ecactly what you are telling it to do which is Write "1WORDS" to a1, A5 down to A37 The 1 comes from the X loop and words from the Y loop The macrow then overwrites each of these cells with 2Words, 3words etc up to 10Words. Mike "donbowyer" wrote: Sub MyNext() For X = 1 To 10 Step 1 For Y = 1 To 40 Step 4 Range("A" & Y) = X & "Words" Next Y Next X End Sub Y iterates OK but X never gets a look in?? -- donwb |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Which of course works.
Many thanks - the simple answer was elududing me Don -- donwb "Mike H" wrote: Try this Sub MyNext() x = 1 For Y = 1 To 40 Step 4 Range("A" & Y) = x & "Words" x = x + 1 Next End Sub Mike "donbowyer" wrote: Hi Mike Yes I agree. What I would like it to do is put "1Word" in Cell A1, then "2Word" in cell A5, then "3Word" in A9 etc Don -- donwb "Mike H" wrote: What are you expecting it to do because (probably infuriatingly for you)it is doing ecactly what you are telling it to do which is Write "1WORDS" to a1, A5 down to A37 The 1 comes from the X loop and words from the Y loop The macrow then overwrites each of these cells with 2Words, 3words etc up to 10Words. Mike "donbowyer" wrote: Sub MyNext() For X = 1 To 10 Step 1 For Y = 1 To 40 Step 4 Range("A" & Y) = X & "Words" Next Y Next X End Sub Y iterates OK but X never gets a look in?? -- donwb |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Your welcome
"donbowyer" wrote: Which of course works. Many thanks - the simple answer was elududing me Don -- donwb "Mike H" wrote: Try this Sub MyNext() x = 1 For Y = 1 To 40 Step 4 Range("A" & Y) = x & "Words" x = x + 1 Next End Sub Mike "donbowyer" wrote: Hi Mike Yes I agree. What I would like it to do is put "1Word" in Cell A1, then "2Word" in cell A5, then "3Word" in A9 etc Don -- donwb "Mike H" wrote: What are you expecting it to do because (probably infuriatingly for you)it is doing ecactly what you are telling it to do which is Write "1WORDS" to a1, A5 down to A37 The 1 comes from the X loop and words from the Y loop The macrow then overwrites each of these cells with 2Words, 3words etc up to 10Words. Mike "donbowyer" wrote: Sub MyNext() For X = 1 To 10 Step 1 For Y = 1 To 40 Step 4 Range("A" & Y) = X & "Words" Next Y Next X End Sub Y iterates OK but X never gets a look in?? -- donwb |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
why doesn't this simple macro work in excel 2007? | Excel Discussion (Misc queries) | |||
So simple, but I can't get it to work | Excel Discussion (Misc queries) | |||
Why doesn't my simple macro work? | Excel Programming | |||
Simple Macro, works in Excel 2002, 2003 but won't work in 2000 | Excel Programming | |||
Why this simple macro doesn't work? | Excel Programming |