Sub ou função não definida: Executando uma macro no excel 2016 [closed]

0

Estou tentando executar uma macro no Excel para remover valores duplicados de cada coluna sem afetar os valores de outras colunas e obtendo o seguinte erro

Compile Time error: Sub or function not defined

Abaixo está minha macro

Sub RemoveDups()

Dim wrkSht As Worksheet
Dim lLastCol As Long
Dim lLastRow As Long
Dim i As Long

'Work through each sheet in the workbook.
For Each wrkSht In ThisWorkbook.Worksheets

    'Find the last column on the sheet.
    lLastCol = LastCell(wrkSht).Column

    'Work through each column on the sheet.
    For i = 1 To lLastCol

        'Find the last row for each column.
        lLastRow = LastCell(wrkSht, i).Row

        'Remove the duplicates.
        With wrkSht
            .Range(.Cells(1, i), .Cells(lLastRow, i)).RemoveDuplicates 
Columns:=1, Header:=xlNo
        End With
    Next i

Next wrkSht

End Sub

alguém pode me ajudar com isso ... obrigado

    
por Aditya Hariharan 19.04.2017 / 13:12

1 resposta

1

LastCell(wrkSht).

Não consegue encontrar a função LastCell no seu projeto VBA.

    
por 19.04.2017 / 13:15