3 - Curso VBA básico P1


Bem vindo ao nosso curso de Excel VBA básico grátis e completo (parte 1).


Com apenas 24 vídeos, mais o nosso e-book grátis, você aprenderá VBA e executará tarefas que as fórmulas não permitem. Qualquer pessoa é capaz de aplicar os conhecimentos aqui exibidos. Confira!

Sugestão: baixe o e-book para um melhor aprendizado, clique aqui p/ download.



Menu da página (vídeos):
00: a) apresentação do ebook grátis      
01: a) objetos, propriedades, métodos
          e funções
      b) preparando seu Excel para VBA
02: a) os primeiros códigos
      b) um pouco sobre "Variáveis"
03: a) hierarquia dos objetos
      b) método select
      c) objetos "Cell" e "Range"
04: a) select "Range" em outra plan.
05: a) select linha(s) e coluna(s)
      b) limpar conteúdo da "Range"
      c) MsgBox simples
06: a) inserir valor na "Range"
      b) oper. matem. entre "Ranges"
      c) declaração "With... End With"
      d) propriedades da "Range"    
07: a) propriedades da "Range"
      b) tabela "ColorIndex"
      c) tabela "RGB"
08: a) cor de fonte
      b) cor interna
09: a) copiar e colar
      b) colar especial
      c) modo copiar e cortar


00 - Apresentação do curso e e-book

Para download, clique aqui: download aqui


01 - Excel VBA (Fundamentos 1)



02 - Excel VBA (Fundamentos 2)



03 - Excel VBA (Fundamentos 3)

CÓDIGOS DO VÍDEO: 
Sub Teste_Basico01_Selecionar1()
      Cells(70, 2).Select
End Sub



4 - Excel VBA Básico (vídeo 4)

CÓDIGOS DO VÍDEO:
Sub Teste_Basico_Selecionar02()
       Set shtInter = Sheets("VBA Inter.")
       shtInter.Activate
       Cells(70, 2).Select
End Sub


'----------------------------------------------
Sub Teste_Basico02_Selecionar3()
        Range("B119:D120").Select
End Sub


'----------------------------------------------

Sub Teste_Basico_Selecionar04()
       Set shtInter = Sheets("VBA Inter.")
       shtInter.Activate
       Range("B119:D120").Select
End Sub



05 - Excel VBA Básico (vídeo 5)

CÓDIGOS DO VÍDEO:
Sub Teste_Basico_Selecionar05()
       Rows("3").Select
End Sub


'----------------------------------------------
 Sub Teste_Basico_Selecionar06()
       Columns("B").Select
End Sub


'----------------------------------------------
 Sub Teste_Basico03_Selecionar7()
       Cells(184, 2).Select
       Selection.ClearContents
End Sub


'---------------------------------------------- 
Sub Teste_Basico04_Mensagem1()
       MsgBox "Esta é uma simples mensagem!"
End Sub



Exercícios (parte 1)

Baixe o e-book para fazer os demais exercícios: download aqui


06 - Excel VBA Básico (vídeo 6)

CÓDIGOS DO VÍDEO:
Sub Teste_Basico05_InserirValor1()
       Cells(200, 2).Value = 2
End Sub


'----------------------------------------------
Sub Teste_Basico06_InserirValor2()
       Cells(207, 2).Value = "Valor"
End Sub


'----------------------------------------------
Sub Teste_Basico07_Operacao01()
       Cells(237, 6).Value = Cells(237, 2).Value / Cells(237, 4).Value
End Sub


'----------------------------------------------        
Sub Teste_Basico08_Operacao02()
       Cells(237, 6).Value = Cells(237, 2).Value * Cells(237, 4).Value
End Sub


'----------------------------------------------        
Sub Teste_Basico09_Operacao03()
       Cells(237, 6).Value = Cells(237, 2).Value + Cells(237, 4).Value
End Sub


'----------------------------------------------        
Sub Teste_Basico10_Operacao04()
       Cells(237, 6).Value = Cells(237, 2).Value - Cells(237, 4).Value
End Sub


'----------------------------------------------
Sub Teste_Basico11_PropriedadesRange01()
       Range("B282").Select
       With Selection
           .HorizontalAlignment = xlRight
           .VerticalAlignment = xlCenter
       End With
End Sub


'----------------------------------------------
Sub Teste_Basico12_PropriedadesRange02()
       Range("B282").Select
       With Selection
           .HorizontalAlignment = xlLeft
           .VerticalAlignment = xlCenter
       End With
End Sub



07 - Excel VBA Básico (vídeo 7)


CÓDIGOS DO VÍDEO:
Sub Teste_Basico13_Formatacao01()
    Range("B329").Select
    Selection.Font.Bold = True
End Sub


'----------------------------------------------
Sub Teste_Basico14_Formatacao02()
    Range("B329").Select
    Selection.Font.Italic = True
End Sub


'----------------------------------------------
Sub Teste_Basico15_Formatacao03()
    Range("B329").Select
    Selection.Font.Underline = True
End Sub


'----------------------------------------------       
Sub Teste_Basico16_Formatacao04()
    Range("B329").Select
    Selection.Font.Bold = False
    Selection.Font.Italic = ClearFormats
    Selection.Font.Underline = False
End Sub


'----------------------------------------------
Sub Teste_Basico17_Formatacao05()
    Range("B356").Font.Bold = True
End Sub


'----------------------------------------------
Sub Teste_Basico18_Formatacao06()
    Range("B356").Font.FontStyle = "None"
End Sub


'----------------------------------------------
Sub Teste_Basico19_Formatacao07()
    Range("B379").Select
    Selection.Font.Size = 18
End Sub


'----------------------------------------------
Sub Teste_Basico20_Formatacao08()
    Range("B379").Select
    Selection.Font.Size = 11
End Sub


'----------------------------------------------
Sub Teste_Basico21_Formatacao09()
    Range("B394").Font.Size = 18
End Sub


'----------------------------------------------
Sub Teste_Basico22_Formatacao10()
    Range("B394").Font.Size = 11
End Sub


'----------------------------------------------
Sub Teste_Basico23_Formatacao11()
    Range("B410").Select
     With Selection.Font
         .ColorIndex = 3
     End With
End Sub


'----------------------------------------------
Sub Teste_Basico24_Formatacao12()
    Range("B410").Select
    Selection.Font.ColorIndex = 5
End Sub


'----------------------------------------------
Sub Teste_Basico25_Formatacao13()
    Dim shtBasico As Worksheet
    Set shtBasico = Sheets("VBA Básico")
    shtBasico.Range("B410").Select
    Selection.Font.ColorIndex = 4
End Sub


'----------------------------------------------
Sub Teste_Basico26_Formatacao14()
    Range("B441").Font.ColorIndex = 3
End Sub


'----------------------------------------------
Sub Teste_Basico27_Formatacao15()
    Range("B441").Font.ColorIndex = 4
End Sub


'----------------------------------------------    
Sub Teste_Basico28_Formatacao16()
    Dim shtBasico As Worksheet
    Set shtBasico = Sheets("VBA Básico")
    Range("B441").Font.ColorIndex = 5
End Sub



08 - Excel VBA Básico (vídeo 8)

 
  
CÓDIGOS DO VÍDEO:
Sub Teste_Basico29_Formatacao17()
    Range("B465").Select
    With Selection.Font
        .Color = RGB(255, 0, 0)
     End With
End Sub


'----------------------------------------------  
Sub Teste_Basico30_Formatacao18()
    Range("B465").Select
    Selection.Font.Color = RGB(0, 255, 0)
End Sub


'----------------------------------------------          
 Sub Teste_Basico31_Formatacao19()
    Dim shtBasico As Worksheet
    Set shtBasico = Sheets("VBA Básico")
    shtBasico.Range("B465").Select
    Selection.Range("B465").Font.Color = RGB(0, 0, 255)
End Sub


'----------------------------------------------  
Sub Teste_Basico32_Formatacao20()
    Range("B501").Font.Color = RGB(255, 0, 0)
End Sub


'----------------------------------------------  
Sub Teste_Basico33_Formatacao21()
    Dim shtBasico As Worksheet
    Set shtBasico = Sheets("VBA Básico")
    shtBasico.Range("B501").Font.Color = RGB(0, 0, 255)
End Sub


'----------------------------------------------  
Sub Teste_Basico34_Formatacao22()
    Range("B524").Select
    With Selection.Interior
         .ColorIndex = 3
     End With
End Sub


'----------------------------------------------          
Sub Teste_Basico35_Formatacao23()
    Range("B524").Select
    Selection.Interior.ColorIndex = 5
End Sub


'----------------------------------------------  
Sub Teste_Basico36_Formatacao24()
    Dim shtBasico As Worksheet
    Set shtBasico = Sheets("VBA Básico")
    shtBasico.Range("B524").Select
    Selection.Interior.ColorIndex = 4
End Sub


'----------------------------------------------  
Sub Teste_Basico37_Formatacao25()
    Range("B548").Interior.ColorIndex = 3
End Sub


'----------------------------------------------  
Sub Teste_Basico38_Formatacao26()
    Dim shtBasico As Worksheet
    Set shtBasico = Sheets("VBA Básico")
    Range("B548").Interior.ColorIndex = 5
End Sub


'----------------------------------------------  
Sub Teste_Basico39_Formatacao27()
    Range("B565").Select
    With Selection.Interior
        .Color = RGB(255, 0, 0)
    End With
End Sub


'----------------------------------------------  
Sub Teste_Basico40_Formatacao28()
    Range("B565").Select
    Selection.Interior.Color = RGB(0, 255, 0)
End Sub


'----------------------------------------------  
Sub Teste_Basico41_Formatacao29()
    Range("B578").Interior.Color = RGB(0, 0, 0)
End Sub


'----------------------------------------------  
Sub Teste_Basico42_Formatacao30()
    Dim shtBasico As Worksheet
    Set shtBasico = Sheets("VBA Básico")
    shtBasico.Range("B578").Interior.Color = RGB(255, 255, 255)
End Sub



Exercícios (parte 2)

Baixe o e-book para fazer os demais exercícios: download aqui


09 - Excel VBA Básico (vídeo 9)

CÓDIGOS DO VÍDEO:
Sub Teste_Basico_Copiar_Colar()
    Range("B3").Select
    Selection.Copy
    Range("D3").Select
    ActiveSheet.Paste
End Sub


'----------------------------------------------   
Sub Teste_Basico_Copiar_Colar2()
    Range("B3").Copy
    Range("D3").PasteSpecial
End Sub


'----------------------------------------------              
Sub Teste_Basico_Copiar_Colar3()
    [B3].Copy [D3]
End Sub


'----------------------------------------------  
Sub Teste_Basico_ColarEspecial01()
    Range("B3").Select
    Selection.Copy
    Range("D3").PasteSpecial Paste:=xlPasteAll
End Sub

 
A última linha deste código poderá ser substituída por:
Range("D3").PasteSpecial Paste:=xlPasteValues
ou
Range("D3").PasteSpecial Paste:=xlPasteFormulas
ou
Range("D3").PasteSpecial Paste:=xlPasteFormats
ou
Range("D3").PasteSpecial Paste:=xlPasteAllExceptBorders
ou
Selection.PasteSpecial Paste:=xlPasteValues, _
SkipBlanks:=True
ou
Selection.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlAdd
ou
Selection.PasteSpecial Paste:=xlPasteValues, _
SkipBlanks:=True, Operation:=xlAdd
 

Todo o interior deste código poderá ser substituído por:
Range("D3").Select
With Selection
     .Cells.PasteSpecial Paste:=xlPasteAllExceptBorders
End With



Próxima página






Comentários