Hey guys I have been pulling my hair out trying to figure out why I am getting a next without for compile error. I'm running Excel 2010 and believe I have looped my Do While statement, looped my For Next statement, and also closed my if statement. My simplified code block is below. What am I missing here? Also, if someone could help me with the tag to preserve tabs, i would be most gracious...the code tag didn't work for me<CODE>
<CODE>
<CODE>
Do While strFile <> ""
Workbooks.Open (strMyDir & strFile)
Workbooks(strFile).Activate
intWkSheetCount = 1
For intWkSheetCount = 1 To Worksheets.Count
Worksheets(intWkSheetCount).Activate
Application.ScreenUpdating = True
If ActiveSheet.Name = "Instructions" Or ActiveSheet.Name = "CountryPortfolioAssumptions" Or
ActiveSheet.Name = "CountryLevelSummary" Or ActiveSheet.Name = "SiteReference" Then
Next intWkSheetCount
Else
'copy paste process here
End If
Next intWkSheetCount
Workbooks(strFile).Close SaveChanges:=False
strFile = Dir() 'cycle to next file
Loop
</CODE)< CODE>
</CODE></CODE>
</CODE>
<CODE>
<CODE>
Do While strFile <> ""
Workbooks.Open (strMyDir & strFile)
Workbooks(strFile).Activate
intWkSheetCount = 1
For intWkSheetCount = 1 To Worksheets.Count
Worksheets(intWkSheetCount).Activate
Application.ScreenUpdating = True
If ActiveSheet.Name = "Instructions" Or ActiveSheet.Name = "CountryPortfolioAssumptions" Or
ActiveSheet.Name = "CountryLevelSummary" Or ActiveSheet.Name = "SiteReference" Then
Next intWkSheetCount
Else
'copy paste process here
End If
Next intWkSheetCount
Workbooks(strFile).Close SaveChanges:=False
strFile = Dir() 'cycle to next file
Loop
</CODE)< CODE>
</CODE></CODE>
</CODE>
Last edited: