sasha
02-12-2011, 06:25 AM
Hi People,
I'm pretty new to writing code and have an issue with one piece for a long macro I'm writing. The section is:
For i = 0 To NoCols
For j = 1 To NoRows
If Sheets(InputSheet).Cells(startrow + j, startcol + i) = "" Then
MsgBox ("Error in Data - Blank Cell")
End
End If
tempstr = Cells(startrow + j, startcol + i).Text
Count = 1
Do While Count <= Len(tempstr)
If Mid(tempstr, Count, 1) = "," Then
MsgBox ("Error in Data - Comma Present")
End
End If
Count = Count + 1
Loop
Next i
Next j
The error I get is 'Invalid next control reference'
Any idea why that is because it looks the same as alot of similar stuff thats worked fine for me before.
Thanks in advance
I'm pretty new to writing code and have an issue with one piece for a long macro I'm writing. The section is:
For i = 0 To NoCols
For j = 1 To NoRows
If Sheets(InputSheet).Cells(startrow + j, startcol + i) = "" Then
MsgBox ("Error in Data - Blank Cell")
End
End If
tempstr = Cells(startrow + j, startcol + i).Text
Count = 1
Do While Count <= Len(tempstr)
If Mid(tempstr, Count, 1) = "," Then
MsgBox ("Error in Data - Comma Present")
End
End If
Count = Count + 1
Loop
Next i
Next j
The error I get is 'Invalid next control reference'
Any idea why that is because it looks the same as alot of similar stuff thats worked fine for me before.
Thanks in advance