-
Solved: Next without For error
Hi,
I'm getting a compile error - 'Next without For' for the following code. I don't understand why.
[vba]Sub test()
For Counter = 7 To 1000
Set curCell = Worksheets("Sheet1").Cells(Counter, 4)
If curCell.Value = "Yes" Then
curCell.Offset(0, 1).Value = "n/a"
Next Counter
End Sub[/vba]
Any ideas?
Thanks.
-
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
-
or put[VBA]If curCell.Value = "Yes" Then
curCell.Offset(0, 1).Value = "n/a"
[/VBA]all on the same line:[VBA]If curCell.Value = "Yes" Then curCell.Offset(0, 1).Value = "n/a"
[/VBA]
p45cal
Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules