Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
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?

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,726
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
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
End If
Next f1
MyCake = MsgBox(myFile.Name, 65, "MsgBox Example")
End Sub

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


wrote in message
oups.com...
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?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom error bars not working [email protected] Charts and Charting in Excel 3 December 8th 05 10:17 AM
Formula Problem - interrupted by #VALUE! in other cells!? Ted Excel Worksheet Functions 17 November 25th 05 05:18 PM
Problem Opening an Excel File MSO9.DLL Error Mash23 Links and Linking in Excel 0 August 24th 05 03:21 PM
error "module not found" Amit Excel Discussion (Misc queries) 1 May 13th 05 01:24 PM
#REF error Christen Excel Worksheet Functions 5 November 3rd 04 07:29 PM


All times are GMT +1. The time now is 01:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"