Alpha Numeric’s bunch together

R

Rob

Hi,

When I type code the alpha numeric’s sometimes bunch together and the font
changes to red as in the case below. As in For i =1To2 and Nexti .

Sub CopyDemand()
Dim i As Integer
For i =1To2
Sheets("Demand").Select
ActiveCell.Offset(0, 2).Activate
ActiveCell.Copy
Sheets("Demand1").Activate
ActiveCell.Offset(0, 1).Activate
ActiveCell.PasteSpecial
Nexti
End Sub

Being a newbie at VBA programming I am sure there is a very simple
explanation for this.

Please will someone tell me what is happening.

Thank you.
 
O

OssieMac

Hi Rob,

Just insert some spaces between the words/numbers. VBA thinks it is one
string when the delimiter spaces are not included.

Example
For i = 1 To 2

With some code like endif VBA is smart enough to insert the spaces for you
and change it to End If but this does necessarily occur with all code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Error 2042 problem with vlookup 0
MACROS DATES 4
Help with error 53 8
stopping a macro 0
PLEASE help ... 3
setting more than one filter 1
input numbers for code 3
ActiveCell.Value just disappears .... ? 2

Top