-1

This is the code within one of my subs in VBA. But I get the 'ByRef Argument Type Mismatch' Error. Matchup_record is a separate function which has been tested using strings inputted with apostrophes.

Dim homeTeam, awayTeam as String

homeTeam = Application.InputBox(prompt:="Who is the home team?", Title:="Home Team", Type:=2)
awayTeam = Application.InputBox(prompt:="Who is the away team?", Title:="Second Team", Type:=2)

matchup_record homeTeam, awayTeam
tg8
  • 29
  • 6
  • 1
    Your problem is most likely the definition of your variables: You need to specify the data type for every variable separately. Your definition defines `homeTeam` as a Variant - which *can* hold a string, but is not a string variable. Change the definition to `Dim homeTeam as String, awayTeam as String` – FunThomas Aug 10 '23 at 07:16
  • This is related to `matchup_record` Function/Sub arguments type. If they are declared `As String` you should use `CStr(nomeTeam)` and the same for the second one. Or declare Function arguments `As Variant`... – FaneDuru Aug 10 '23 at 07:17

0 Answers0