maomelov Posted October 16, 2013 at 08:19 PM Report #529294 Posted October 16, 2013 at 08:19 PM tenho o seguinte codigo para contar as celulas preenchidas na coluna F da folha Carros... Da-me erro e diz que "Objet variable or with block variable ot set" run time error '91' Worksheets("Carros").Activate Set a = Worksheets("Carros").Range("F1") UltLin = Cells(a.Rows.count, "F").End(xlUp).Row contav = 0 For celula = a To UltLin If (celula.Value <> "") Then contav = contav + 1 End If Next
rodrigolima Posted October 18, 2013 at 04:22 PM Report #529630 Posted October 18, 2013 at 04:22 PM Boa tarde maomelov Tente fazer assim: Dim a As Worksheet Dim faixa As Range 'Definir que a é a sheet Carros Set a = Worksheets("Carros") a.Activate 'Setar Range para toda a coluna F Set faixa = a.Range("F:F") 'Coluna 6(F) - Contar linhas UltLin = Cells(faixa.Rows.Count, 6).End(xlUp).Row Espero ter ajudado.Sucesso
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now