vba question

  Josquius 18:33 19 Jan 2005

I have dim hello(100) as integer before my sub then in my sub I have

for hello(0 to 100) Worksheets("lemon").Cells(2,1).value= worksheets("lemon").cells(1,1) however this does not work. I get a syntax error. What have I done wrong? I have never used multiple integers in this way before. I get a sytax error with to highlighted however VBA itself told me to put that there.

  VoG II 18:37 19 Jan 2005

I don't understand what this code is meant to do.

The correct syntax for a For statement is

For hello = 0 To 100

Worksheets("lemon").Cells(2, 1).Value = Worksheets("lemon").Cells(1, 1)

Next hello

  VoG II 18:39 19 Jan 2005

If you Dim hello(100)

the elements of the array will be hello(0) to hello(99) unless you use Option Base 1 at the top of the module, in which case they will run from hello(1) to hello(100)

  Josquius 18:43 19 Jan 2005

I made a mistake originally, it isn't 2,1 and 1,1 its 2, hello and 1,hello.
Doing what you said despite this I get a type mismatch with it identified as a integer before hand and syntax error without.

  VoG II 18:50 19 Jan 2005

Dim hello(1 To 100) As Integer

Dim i as integer

For i = 1 To 100

Worksheets("lemon").Cells(2, hello(i)).Value = Worksheets("lemon").Cells(1, hello(i))

Next i

  VoG II 20:10 19 Jan 2005

I'm still puzzling over what you are wanting to do. If you just want to copy the contents of A1:A100 to B1:B100

For i = 1 To 100

Worksheets("lemon").Cells(2, i).Value = Worksheets("lemon").Cells(1, i).Value

Next i

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

iPhone X review

How to find a font: Discover the name of a typeface with these apps

The best iPhone for 2017

Comment créer un compte PayPal pour payer en ligne ?