View Single Post
  #2   Report Post  
Chip Pearson
 
Posts: n/a
Default

No, the code syntax you describe will not work. Try something
like

For X = whatever to whatever
If olDate = Date Then
' your code here
End If
Next X

You could also forego using a For Next loop and use a Do
While/Until Loop, which allows you to change an index whenever
you need to.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"littlegreenmen1"
<littlegreenmen1.1qbsyd_1118264706.1975@excelfor um-nospam.com
wrote in message
news:littlegreenmen1.1qbsyd_1118264706.1975@excelf orum-nospam.com...

I have a For/Next Loop setup, but in the middle of it I need an
If/Then
Statement. My For/Next Loop scans a list of Dates and then
transfers
them to an Outlook Calender. However, I dont need it to
transfer
anything from before the day I run the macro. I tried
inserting the
following code:

If olDate < Date Then
Next x
End If

When I use this I get a Next without For error. Is there a way
to use
Next inside an If/Then conditional if the For resides outside
the
If/Then? Thank you very much for any and all help.


--
littlegreenmen1
------------------------------------------------------------------------
littlegreenmen1's Profile:
http://www.excelforum.com/member.php...o&userid=23978
View this thread:
http://www.excelforum.com/showthread...hreadid=377526