none
ERRO EM TEMPO DE EXECUÇÃO '13': RRS feed

  • Pergunta

  • PEssoal, boa tarde

    Não tenho nenhuma experiencia com VBA, mas utilizo uma macro pra gerar um relatório, sempre deu certo e se outras pessoas rodam a macro, funciona perfeitamente, comigo aparece este erro:

    ERRO EM TEMPO DE EXECUÇÃO '13':

    TIPOS INCOMPATÍVEIS

    SEGUE ABAIXO. ONDE APARENTEMENTE ESTÁ O ERRO EM NEGRITO

    Sheets("AMPM + 2").Select
        If Range("A2") = "" Then
        GoTo FimAMPM2
        End If
        If Application.WorksheetFunction.CountA(Range(Cells(2, 1), Cells(3, 1))) > 1 Then
            Range(Cells(2, 1), Selection.End(xlDown).End(xlToRight)).Copy
            Else
            Range(Cells(2, 1), Selection.End(xlToRight)).Copy
            End If
    Sheets("Geral").Select
        Geral.Cells(2, 1).End(xlDown).Offset(1, 0).Select
        ActiveSheet.Paste
    FimAMPM2:

    Sheets("Geral").Activate

    i = 2
        Do While Cells(i, 1) <> Empty
           Cells(i, 13) = DateValue(Cells(i, 3))
            Cells(i, 14) = DateValue(Cells(i, 4))
            i = i + 1
        Loop
            Range(Cells(2, 13), Cells(2, 14).End(xlDown)).Select
        With Selection
            .Copy
            .PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
        End With

    Range(Cells(2, 3), Cells(2, 4).End(xlDown)).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
    Range(Cells(2, 3), Cells(2, 4).End(xlDown)).NumberFormat = "m/d/yyyy"
    Columns("M:N").Delete

    Range(Cells(1, 1), Cells(1, 13)).Font.Bold = True
    Range(Cells(1, 1), Cells(1, 1).End(xlDown).End(xlToRight)).Select
       
       
        With Selection.Borders(xlEdgeLeft)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlThin
        End With
        With Selection.Borders(xlEdgeTop)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlThin
        End With
        With Selection.Borders(xlEdgeBottom)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlThin
        End With
        With Selection.Borders(xlEdgeRight)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlThin
        End With
        With Selection.Borders(xlInsideVertical)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlThin
        End With
        With Selection.Borders(xlInsideHorizontal)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlThin
        End With

        Columns("B:B").Insert Shift:=xlToLeft
        Columns("D:D").Insert Shift:=xlToLeft
        Columns("I:I").Insert Shift:=xlToLeft
        Range(Cells(1, 14), Cells(1, 14).End(xlDown)).Copy
        Cells(1, 2).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
        Range(Cells(1, 13), Cells(1, 13).End(xlDown)).Copy
        Cells(1, 4).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
        Range(Cells(1, 15), Cells(1, 15).End(xlDown)).Copy
        Cells(1, 9).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
        Columns("M:O").Delete Shift:=xlToLeft
        Cells(1, 13) = "Justificativa"
        Range(Cells(2, 4), Cells(2, 4).End(xlDown)).NumberFormat = "0"
        Range(Cells(2, 9), Cells(2, 10).End(xlDown)).NumberFormat = "0"

    Cells.EntireColumn.AutoFit
    Application.ScreenUpdating = True

    End Sub

    quinta-feira, 23 de abril de 2020 16:19