Excluir células num...
 
Notifications
Clear all

Excluir células numa linha em userform

1 Posts
1 Usuários
0 Likes
380 Visualizações
(@albino10)
Posts: 24
Eminent Member
Topic starter
 

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

 
Postado : 03/05/2023 1:06 pm