Jump to content

Recommended Posts

Posted

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
Posted

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.