Vídeo recomendado
https://youtu.be/Ju8Esra5--I

Excluir células numa linha em userform

Fórum para dúvidas sobre os fundamentos da linguagem de programação Visual Basic no contexto do VBA
Albino Sergio
Colaborador
Colaborador
Mensagens: 12
Registrado em: Sex Nov 05, 2021 10:11 am

Excluir células numa linha em userform

Mensagem por Albino Sergio »

Olá senhores, estou tentando (sou leigo) e ainda não consegui um comando no userform que EXCLUA células numa mesma linha (ex: "D10:H10" e "M10:Q10") conforme a linha buscada pelo ID.

Private Sub BtExcluirCob_Click()
Dim confirmar As String
Plan4.Activate
Dim plan As String
plan = Plan4.Name

confirmar = MsgBox("Tem certeza que deseja EXCLUIR o Cliente?", vbYesNo, "Excluir!")
If confirmar = vbNo Then
MsgBox "Exclusão do Cliente" vbInformation, "Exclusao cancelada!"
Unload Cobrança
Exit Sub
End If

valor_Processo = TXT_ID.Value
ult_linha = Range("T3000").End(xlUp).Row
For linha = 2 To ult_linha
If Cells(linha, 4).Value = valor_Processo Then
Plan4.Range(Cells(linha, 4), Plan4.Cells(linha, 8)).Delete Shift:=xlUp
Plan4.Range(Cells(linha, 13), Plan4.Cells(linha, 17)).Delete Shift:=xlUp

linha = linha - 1
End If
Next

'ActiveWorkbook.Save
MsgBox "Cadastro do cliente " & Me.Txt_Cliente_Cob & " foi EXCLUIDO com sucesso!",
vbInformation, "Excluído!"
Erro:
MsgBox "Erro!", vbCritical, "ERRO"

End Sub


Disable adblock

This site is supported by ads and donations.
If you see this text you are blocking our ads.
Please consider a Donation to support the site.


Responder