Hello
The red GoTo pair below are returning the compile error "Expected: line number or label". The only difference I can see between this GoTo and the others I've used is that this GoTo is not nested within an IF statement. I've been searching for information on whether the GoTo command must be nested within some other statement in order to function (when it's not the "On Error GoTo" command), but I haven't been able to turn up any solid information on this.
Does GoTo have to be nested, or is there something else wrong here? I don't define "Shared" as an argument, function, sub, etc., anywhere else.
Private Sub cmdSearch_Click()
Dim LSearchRow As Integer
Dim LSearchRowAdd As Integer
Dim LSearchRowM As Integer
Dim LCopyToRow As Integer
Dim LCopyToRowAdd As Integer
Dim LCopyToRowAm As Integer
Dim LCopyToRowM As Integer
Dim LStartingToRow As Integer
On Error GoTo Err_Execute
'Start search in row 3
LSearchRow = 3
LSearchRowAdd = 3
LSearchRowM = 3
LCopyToRow = 15
LCopyToRowAdd = 3
LCopyToRowAm = 3
LCopyToRowM = 3
LStartingToRow = 15
Dim iResponse As Integer
Dim Response As Boolean
Response = True
iResponse = MsgBox(Prompt:="Is this a Candidate List for either a Versioned or a Banking Jurisdiction?", Buttons:=vbYesNo)
Select Case iResponse
Case vbYes
Response = True
Case vbNo
Response = False
End Select
If Response = True Then
GoTo versions
Else
GoTo nonversioned
End If
versions:
Sheets(6).Select
If ActiveSheet.Cells(LCopyToRowAdd, 5).Value = "" Then
Sheets(1).Select
Call GenerateAddsList(LSearchRowAdd, LCopyToRowAdd)
Else
MsgBox "Adds list was already generated."
End If
Sheets(7).Select
If ActiveSheet.Cells(LCopyToRowAm, 5).Value = "" Then
Sheets(1).Select
Call GenerateAmsList(LCopyToRowAm)
Else
MsgBox "Amends list was already generated."
End If
nonversioned:
Sheets(8).Select
If ActiveSheet.Cells(4, 5).Value = "" Then
Sheets(6).Select
Call GenerateMList(LSearchRowM)
Else
MsgBox "Multiples list was already generated."
End If
If Response = True Then
GoTo versions1
Else
GoTo nonversioned1
End If
versions1:
Sheets(1).Select
Do While Len(Range("Q" & CStr(LSearchRow)).Value) > 0
Dim Pten As Integer
Pten = Range("Q" & CStr(LSearchRow)).Value / 10
Dim NumOfHits As Integer
NumOfHits = Ceiling(Pten, 1)
Dim AudCritMessage As String
AudCritMessage = Range("P" & CStr(LSearchRow)).Value
'MsgBox "I am returning " & NumOfHits & " hits for " & AudCritMessage
Call FindValue1(LSearchRow, LCopyToRow, LStartingToRow, NumOfHits)
If LCopyToRow < LStartingToRow + NumOfHits Then
Call FindValue2(LSearchRow, LCopyToRow, LStartingToRow, NumOfHits)
End If
LSearchRow = LSearchRow + 1
LStartingToRow = LStartingToRow + NumOfHits
Loop
Application.CutCopyMode = False
Range("A1").Select
GoTo Shared
nonversioned1:
Sheets(1).Select
Do While Len(Range("Q" & CStr(LSearchRow)).Value) > 0
Dim Pten As Integer
Pten = Range("Q" & CStr(LSearchRow)).Value / 10
Dim NumOfHits As Integer
NumOfHits = Ceiling(Pten, 1)
Dim AudCritMessage As String
AudCritMessage = Range("P" & CStr(LSearchRow)).Value
'MsgBox "I am returning " & NumOfHits & " hits for " & AudCritMessage
Call FindValue5(LSearchRow, LCopyToRow, LStartingToRow, NumOfHits)
LSearchRow = LSearchRow + 1
LStartingToRow = LStartingToRow + NumOfHits
Loop
Application.CutCopyMode = False
Range("A1").Select
Shared:
MsgBox "The Spot-Check Test Review list has been generated."
Exit Sub
Err_Execute:
MsgBox "An error occurred."
End Sub
Bookmarks