dmqueen
Board Regular
- Joined
- Aug 5, 2014
- Messages
- 53
Please help! I cannot get past these compiler errors on my function calls, and I can't figure out why. Neither function returns anything, so it should be straightforward.
I've marked the function calls receiving the errors with asterisks in the code comments and added the functions being called below that.
<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- on ALL sheets!!
'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 = Application.ActiveCell.Row
'Entry starts in Col B
'Start checking for empties!
'next function call copies Machines DropDown selection to worksheet
'Machine Drop dwns are in Col B!
'Compiler won't take function call
'syntax error
'/**********************************************************************************
fShowDDResult(EntryRowNum, 2)
'If no entry selected!
If Application.ActiveCell.Offset(0, 1).Value = "" Then
Call MsgBox("Please enter/select values in all columns and rerun when complete!", vbCritical, Application.Name)
End Sub
Else
'move on to col C
EntryColNum = 3
If ActiveCell.Value = Null Then
'If C is empty, ck for index above, indicating listbox
If ActiveCell.Offset(-3, 1) > 1 Then
'It's a listbox, copy the selected value into the worksheet
'Which listbox?
Application.ActiveCell(EntryRowNum & "C").Select.Value = ActiveSheet.ListBox1.Value
Dim CellLinkRow As Integer
CellLinkRow = EntryRowNum - 3
'another red line
'/***************************************************************************
fLinkedBoxValue(EntryRowNum, EntryRowCol)
Else:
'Ck for Notes field: only allowable blank
If Application.ActiveCell.Offset(-3, 1) = "Notes" Then End If
End If
End If
End If
'move onto Col D
EntryColNum = 4
End Sub
</code>
Functions being called:
<code>
Sub fShowDDResult(CurrRow, CurrCol)
Dim Row As Integer, Col As Integer
Col = CurrCol
Row = CurrRow
Dim dd As DropDown
Set dd = ActiveSheet.DropDowns(Application.Caller)
ActiveSheet.Cells(Row, Col).Value = dd.List(dd.Value)
End Sub
Function fLinkedBoxValue(aRange As Range)
Dim oneShape As Shape
Set aRange = aRange.Cells(1, 1)
For Each oneShape In aRange.Parent.Shapes
With oneShape
If .Type = msoFormControl Then
If .FormControlType = xlListBox Then
If .ControlFormat.LinkedCell = aRange.Address Then
LinkedBoxValue = .ControlFormat.List(.ControlFormat.ListIndex)
End If
End If
End If
End With
Next oneShape
End Function
</code>
I've marked the function calls receiving the errors with asterisks in the code comments and added the functions being called below that.
<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- on ALL sheets!!
'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 = Application.ActiveCell.Row
'Entry starts in Col B
'Start checking for empties!
'next function call copies Machines DropDown selection to worksheet
'Machine Drop dwns are in Col B!
'Compiler won't take function call
'syntax error
'/**********************************************************************************
fShowDDResult(EntryRowNum, 2)
'If no entry selected!
If Application.ActiveCell.Offset(0, 1).Value = "" Then
Call MsgBox("Please enter/select values in all columns and rerun when complete!", vbCritical, Application.Name)
End Sub
Else
'move on to col C
EntryColNum = 3
If ActiveCell.Value = Null Then
'If C is empty, ck for index above, indicating listbox
If ActiveCell.Offset(-3, 1) > 1 Then
'It's a listbox, copy the selected value into the worksheet
'Which listbox?
Application.ActiveCell(EntryRowNum & "C").Select.Value = ActiveSheet.ListBox1.Value
Dim CellLinkRow As Integer
CellLinkRow = EntryRowNum - 3
'another red line
'/***************************************************************************
fLinkedBoxValue(EntryRowNum, EntryRowCol)
Else:
'Ck for Notes field: only allowable blank
If Application.ActiveCell.Offset(-3, 1) = "Notes" Then End If
End If
End If
End If
'move onto Col D
EntryColNum = 4
End Sub
</code>
Functions being called:
<code>
Sub fShowDDResult(CurrRow, CurrCol)
Dim Row As Integer, Col As Integer
Col = CurrCol
Row = CurrRow
Dim dd As DropDown
Set dd = ActiveSheet.DropDowns(Application.Caller)
ActiveSheet.Cells(Row, Col).Value = dd.List(dd.Value)
End Sub
Function fLinkedBoxValue(aRange As Range)
Dim oneShape As Shape
Set aRange = aRange.Cells(1, 1)
For Each oneShape In aRange.Parent.Shapes
With oneShape
If .Type = msoFormControl Then
If .FormControlType = xlListBox Then
If .ControlFormat.LinkedCell = aRange.Address Then
LinkedBoxValue = .ControlFormat.List(.ControlFormat.ListIndex)
End If
End If
End If
End With
Next oneShape
End Function
</code>
Last edited: