没有返回的功能不起作用

时间:2013-05-18 12:48:34

标签: excel vba excel-vba

我有一个调用函数的宏:

Function escreve_mapa(Row As Integer, LastColumn As Integer, equipamentos As interger, Abrangencia As String, medias)
    Dim cell As Range
    Dim colunas As Range
    Dim i As Integer
    Sheets("Mapa de sinais (tabela)").Select
    Cells(Row, "A").Value = Abrangencia
    Cells(Row, "B").Value = equipamentos
    Set cell = Range("C" & Row)
    Set colunas = Range(cell, cell.Offset(0, LastColumn - 3))
    i = 0
    For Each cell In colunas
        If medias(i, 1) > 0 Then
            cell.Value = Round(medias(i, 0) / medias(i, 1), 2)
        End If
        i = i + 1
    Next cell
End Function

但是当它到达这个函数时,它返回错误用户定义的类型未定义

知道为什么吗?

1 个答案:

答案 0 :(得分:3)

你的函数中有一个拼写错误(虽然它不返回任何东西,但它可能是一个sub)。

equipamentos As interger应为equipamentos As Integer