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.
Por Ryujin
Posts
#21764
Boa Tarde !

Eu tenho um codigo que apaga Armazem por ID dos mesmos !

Necessito de um codigo de erro que diga que o ID que eu tentei eliminar nao Existe!

Exemplo!

Tenho 5 Armazens que os IDs correspondestes sao 1 , 2 ,3 , 5 .
Caso eu tente Eliminar o ID 6 , quero que ao carregar no botao Eliminar Diga uma msg de erro a dizer " O Id inserido nao é ixistente"

MUITO MAS MESMO MUITO OBRIGADO PELA AJUDA QUE ME TEM DADO ! SAO 5*
Você não está autorizado a ver ou baixar esse anexo.
Por osvaldomp
#21766
Experimente este código no lugar do atual.
Código: Selecionar todos
Private Sub CommandButton3_Click()
 Dim k As Long
  If Application.CountIf(Sheets("Armazens").[A:A], TextBox1.Text) > 0 Then
   k = Sheets("Armazens").[A:A].Find(TextBox1.Text, lookat:=xlWhole).Row
   Sheets("Armazens").Rows(k).Delete
   MsgBox "Eliminado Com Sucesso!"
  Else: MsgBox "ID inexistente"
  End If
 TextBox1.Text = ""
End Sub
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