View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
donbowyer donbowyer is offline
external usenet poster
 
Posts: 107
Default Why doesn't this simple macro work

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