I am trying to have a sub in VBA call another function, which returns a range and is set to a variable. I am getting a syntax error when I try to run the GetInputs() method.
Function GetDataRange(str As String) As Range
' This prompts the user to select a range of data, we will need to call this once for inputs and once for outputs
Dim rRange As Range
On Error Resume Next
Application.DisplayAlerts = False
Set rRange = Application.InputBox(Prompt:= _
str, _
Title:="SPECIFY RANGE", Type:=8)
On Error GoTo 0
Application.DisplayAlerts = True
If rRange Is Nothing Then
Exit Function
Else
rRange.Font.Bold = True
End If
GetDataRange = rRange
End Function
Sub GetInputs()
Dim rg As Range
Set rg = GetDataRange("Select Inputs:")
End Sub
Edit: I added this code:
Sub Test()
End Sub
When I try to run it I get the same Syntax error with the Sub Test() line highlighted.