dmqueen
Board Regular
- Joined
- Aug 5, 2014
- Messages
- 53
Hello,
For the life of me I cannot find the syntax error in my If Or stmt. I'm hoping fresh eyes an spot it. I tried to clearly mark the problem line with comments, its the line looking for the Notes field. I'd love any help, Thanks!
<code>
Sub fInput_Complete()
'Validate Entries
'copy listbox selections to worksheet
'go to next col
'col B
'verify entry was made
'go to next col
Dim NewRowNum As Integer
'Celllink 3 ROWS ABOVE for bound item where listboxes!!
'Start off in Column B
'Find the row just like in input begin: loop from the top until =, then one down
ActiveSheet.Range("A1").Select
'goto the top, and cycle down each line until you find the top of the entries, "="
'goto the top entry ready to insert the new entry
While ActiveCell.Value <> "="
ActiveCell.Offset(1, 0).Activate
Wend
'OK, we're on the new entry line
Dim EntryRowNum As Integer
Dim EntryColNum As Integer
Dim counter As Integer
counter = 0
EntryRowNum = ActiveCell.Row
'Entry starts in Col B
'Start checking for empties!
Do While counter > 26
counter = counter + 1
Application.ActiveCell.Offset(0, 1).Activate
EntryColNum = Application.ActiveCell.Column
If ActiveCell.Value = Null Then
Call MsgBox("Please enter a value to continue!", vbCritical, Application.Name)
Else:
If ActiveCell.Offset(-3, 1) > 1 Then
'It's a listbox, copy the selected value into the worksheet
EntryColNum = Application.ActiveCell.Column
Application.ActiveCell(EntryRowNum & EntryColNum).Select.Value = ActiveSheet.ListBox.bounditem.Value
Else:
'Ck for Notes field: only allowable blank
'SYNTAX ERROR FROM COMPILER ON NEXT LINE!!!
'/************************************************************************************************************************************************************
If Application.ActiveCell.Offset(-2,1) = "Notes" OR Application.ActiveCell.Offset(-3,1) = "Notes" OR Application.ActiveCell.Offset(-4,1) ="Notes") Then
Loop
End If
End If
Exit Do
End If
End Sub
</code>
For the life of me I cannot find the syntax error in my If Or stmt. I'm hoping fresh eyes an spot it. I tried to clearly mark the problem line with comments, its the line looking for the Notes field. I'd love any help, Thanks!
<code>
Sub fInput_Complete()
'Validate Entries
'copy listbox selections to worksheet
'go to next col
'col B
'verify entry was made
'go to next col
Dim NewRowNum As Integer
'Celllink 3 ROWS ABOVE for bound item where listboxes!!
'Start off in Column B
'Find the row just like in input begin: loop from the top until =, then one down
ActiveSheet.Range("A1").Select
'goto the top, and cycle down each line until you find the top of the entries, "="
'goto the top entry ready to insert the new entry
While ActiveCell.Value <> "="
ActiveCell.Offset(1, 0).Activate
Wend
'OK, we're on the new entry line
Dim EntryRowNum As Integer
Dim EntryColNum As Integer
Dim counter As Integer
counter = 0
EntryRowNum = ActiveCell.Row
'Entry starts in Col B
'Start checking for empties!
Do While counter > 26
counter = counter + 1
Application.ActiveCell.Offset(0, 1).Activate
EntryColNum = Application.ActiveCell.Column
If ActiveCell.Value = Null Then
Call MsgBox("Please enter a value to continue!", vbCritical, Application.Name)
Else:
If ActiveCell.Offset(-3, 1) > 1 Then
'It's a listbox, copy the selected value into the worksheet
EntryColNum = Application.ActiveCell.Column
Application.ActiveCell(EntryRowNum & EntryColNum).Select.Value = ActiveSheet.ListBox.bounditem.Value
Else:
'Ck for Notes field: only allowable blank
'SYNTAX ERROR FROM COMPILER ON NEXT LINE!!!
'/************************************************************************************************************************************************************
If Application.ActiveCell.Offset(-2,1) = "Notes" OR Application.ActiveCell.Offset(-3,1) = "Notes" OR Application.ActiveCell.Offset(-4,1) ="Notes") Then
Loop
End If
End If
Exit Do
End If
End Sub
</code>
Last edited: