Este fórum está sendo desativado

Depois de 9 anos, este fórum será desativado. Mas calma.... estamos migrando para uma comunidade no DISCORD. Junte-se a nós.

ENTRAR PARA DISCORD

Tópicos relacionados a códigos VBA, gravação de macros, etc.
#56636
Bom dia!

Estou acompanhando uma vídeo aula e em paralelo estou fazendo uma planilha dos países por continente. Fiz o código todo certo, porém apareceu esse erro:

Erro em tempo de execução 9: Subscrito fora do intervalo".

Vou postar o código e anexar o arquivo:

Sub Registra()


linha = 2
linha_final = Range("a1").End(xlDown).Row

While Cells(linha, 1) <> ""

country = Cells(linha, 1)
IDH = Cells(linha, 2)
continent = Cells(linha, 3)

ult_linha = Sheets(continent).Range("a10000").End(xlUp).Row + 1 <- aqui é o erro
Sheets(continent).Cells(ult_linha, 1) = country
Sheets(continent).Cells(ult_linha, 2) = IDH
Sheets(continent).Cells(ult_linha, 3) = continent

Range("F2") = linha / linha_final
linha = linha + 1
Wend

End Sub
Você não está autorizado a ver ou baixar esse anexo.
Por osvaldomp
#56639
Substitua as 4 ocorrências de ~~~> Sheets(continent)

por ~~~> Sheets("base_dados")

ou exclua todas as 4 ocorrências, e omita o nome da planilha como está por exemplo em ~~~> Range("F2") = ...
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]

Estamos migrando para uma comunidade no Discord