View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
[email protected] dynamique@gmail.com is offline
external usenet poster
 
Posts: 3
Default Yet Another For without Next Error

Sub Bubbles()
Dim MyFileSystem, MyFolder, f1, FilesQ, s, myFile, MyCake
Set MyFileSystem = CreateObject("Scripting.FileSystemObject")
Set MyFolder = MyFileSystem.GetFolder("C:\Documents and Settings\My
Documents\Inventory Stuff")
Set FilesQ = MyFolder.Files
Dim xDate As Integer
Dim xTime As Integer
Let xDate = 0
Let xTime = 0
Dim DateInt As Integer
Dim TimeInt As Integer
Dim Cake As Boolean
For Each f1 In FilesQ
s = Split(f1.Name, "_", -1, vbTextCompare)
Let Cake = (IsNumeric(s(1)) And IsNumeric(s(2)))
* If Cake = False Then Next
DateInt = CInt(s(1))
TimeInt = CInt(s(2))
If DateInt = xDate Then
If TimeInt xTime Then
'Set DateInt = xDate
'Set TimeInt = xTime
'Set myFile = f1
End If
End If
Next f1
MyCake = MsgBox(myFile.Name, 65, "MsgBox Example")
End Sub

Whenever I run this, I get a "For without Next Error" on the starred
line. I've tried making it a block with an End If, and things run if I
comment it out. Why might this be?