- Detalhes
- Acessos: 234
Excel VBA Celula Range concatenar codigo nome depurar e debug planilha excel
Licao337
Nesse Exemplo de Planilha vamos aprender como cadastrar um Item (Cliente, Fornecedor ou Produto) com código,
com valor max codigo mais 1, concatenar código e nome cadastrado e também separar atraves de critério usado
um simbolo para separarmos atraves do uso da função Instr() do excel vba planilha
vento change, debug vba, depurar vba, busca vba, concatenar vba, mid busca, excel extrair texto vba, extrat text vba,
vba dados extrair, cadastra excel vba,
Promoção Especial:
'------'
Private Sub Worksheet_Change(ByVal t As Range)
Dim wLin As Integer, wColB As Range, wCod As Integer, _
wkf As WorksheetFunction, wBusca As Integer, wNom As String, _
wLen As Integer
'--'
wLin = Cells(Rows.Count, "b").End(xlUp).Row + 1
Set wColB = Range("B2:B" & wLin)
Set wkf = Application.WorksheetFunction
'--
If Not Intersect(t, wColB) Is Nothing And t.Count = 1 Then
If Cells(t.Row, "a") = "" Then
Application.EnableEvents = False
wCod = wkf.Max(Range("A2:A" & wLin)) + 1
Cells(t.Row, "a") = wCod
Cells(t.Row, "c") = wCod & "-" & Cells(t.Row, "b")
'-- separando pelo critério (Cod_nome)
wBusca = VBA.InStr(1, Cells(t.Row, "c"), "-") - 1
wLen = Len(Cells(t.Row, "c"))
wCod = Mid(Cells(t.Row, "c"), 1, wBusca)
wNom = Mid(Cells(t.Row, "c"), wBusca + 2, wLen)
Cells(t.Row, "e") = wCod
Cells(t.Row, "f") = wNom
Application.EnableEvents = True
End If
End If
'--
Set wColB = Nothing
Set wkf = Nothing
End Sub
Sub f1_hab_eventos()
Application.EnableEvents = True
MsgBox "Eventos Habilitados....", vbInformation, "Escola SaberExcel VBA Estudos®"
End Sub
movemouse planilha excel exemplo
Private Sub Label1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Dim Resposta As String
Resposta = MsgBox("Quer se conectar com nosso site ?" & vbCrLf & _
"+ Fiquem com Deus! - Bons Estudos®." & vbCrLf & _
"+ Expedito Marcondes" & vbCrLf & _
"'- - - - - - - - - - - - - - - - - - - - - - - -'" & vbCrLf & _
"+ Escola SaberExcel VBA Estudos" & vbCrLf & _
"'- - - - - - - - - - - - - - - - - - - - - - - -'", vbYesNo + vbQuestion, "Saberexcel - site das macros")
If Resposta = vbYes Then
ThisWorkbook.FollowHyperlink "http://www.saberexcel.com.br/", , True
End If
End Sub Faça o Download da planilha Exemplo Licao - Aula 337 - Modulo2
Licao337 Excel VBA Celula Range concatenar codigo nome depurar e debug planilha excel