Philocthetes
Has a great deal to learn
- Local time
- Today, 12:36
- Joined
- Dec 19, 2017
- Messages
- 28
Hi folks,
When I try to step through the code below, I see get "Compile error: Next without For." But I have a For line. What am I or the compiler missing?
When I try to step through the code below, I see get "Compile error: Next without For." But I have a For line. What am I or the compiler missing?
Code:
Dim Titles
Dim Counter As Long
Range("A1").Select
ActiveCell.Columns("A:A").EntireColumn.Select
For Counter = 1 To 941
Selection.Find(What:="Title", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Range("A1:A2").Select
Set Titles = Cells.Find(What:="Subtitle", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
If Titles Is Nothing Then
ActiveCell.Offset(1, 0).Rows("1:1").EntireRow.Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
ActiveCell.Select
ActiveCell.FormulaR1C1 = "Subtitle"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "None"
ActiveCell.Offset(1, -1).Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Else: Next Counter