Upcoming SlideShare
×

# Excel vba 2007

1,294 views

Published on

Published in: Education
0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
1,294
On SlideShare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
56
0
Likes
0
Embeds 0
No embeds

No notes for slide

### Excel vba 2007

1. 1.
2. 2. Range("I4:N4").Select<br />Selection.Copy<br /> Application.GotoReference:="Fim"<br />Selection.End(xlUp).Select<br />Range(“A9”).Select<br />ActiveSheet.Paste<br /> Application.CutCopyMode = False<br /> Application.GotoReference:="R1C1"<br /> Range("I4:N4").Select<br />Selection.Copy<br /> Application.GotoReference:="Fim"<br />Selection.End(xlUp).Select<br />ActiveCell.Offset(1, 0).Range("A1").Select<br />ActiveSheet.Paste<br /> Application.CutCopyMode = False<br /> Application.GotoReference:="R1C1"<br />
3. 3. Sub Recepcao()<br />'Macro Recepção de Dados<br />DimVarCurso As String<br />DimVarData As Date<br />DimVarParticipante As String<br />DimVarDepto As String<br />DimVarEmpresa As String<br />DimVarCusto As Single<br />VarCurso = Application.InputBox("Entre o Curso:", , , , , , 2) 'O Valor 2 no InputBox para dados Alfanumericos<br />VarData = Application.InputBox("Entre a Data:", , , , , , 1) 'O Valor 1 no InputBox para dados numericos<br />VarParticipante = Application.InputBox("Entre o Participante:", , , , , , 2)<br />VarDepto = Application.InputBox("Entre o Departamento:", , , , , , 2)<br />VarEmpresa = Application.InputBox("Entre a Empresa:", , , , , , 2)<br />VarCusto = Application.InputBox("Entre o Custo:", , , , , , 1)<br />
4. 4. Range("EntraCurso").Select<br />ActiveCell.FormulaR1C1 = VarCurso<br /> Range("EntraData").Select<br />ActiveCell.FormulaR1C1 = VarData<br /> Range("EntraParticipante").Select<br />ActiveCell.FormulaR1C1 = VarParticipante<br /> Range("EntraDepto").Select<br />ActiveCell.FormulaR1C1 = VarDepto<br /> Range("EntraEmpresa").Select<br />ActiveCell.FormulaR1C1 = VarEmpresa<br /> Range("EntraCusto").Select<br />ActiveCell.FormulaR1C1 = VarCusto<br />End Sub<br />
5. 5. Sub SalvaCadastro()<br />'<br />' SalvaCadastro Macro<br />' Salva Cadastro<br />'<br />' Atalho do teclado: Ctrl+s<br />'<br />VarSalva = MsgBox("Deseja Salvar?", 1 + 32, "Salvar Dados")<br />IfVarSalva = vbOKThen<br /> Application.StatusBar = "Salvando Arquivo - Aguarde!!!"<br />ActiveWorkbook.Save<br />MsgBox "Arquivo salvo com sucesso", 64, "Salvo"<br />EndIf<br /> Application.StatusBar = False<br />End Sub<br />
6. 6.
7. 7. Private Sub BotOK_Click()<br />If OptionButton1.Value = TrueThen<br />SortCurso<br />ElseIf OptionButton2.Value = TrueThen<br />SortData<br />ElseIf OptionButton3.Value = TrueThen<br />SortParticipante<br />Else<br />SortRelatorio<br />EndIf<br />End Sub<br />Private Sub BotCancelar_Click()<br /> End<br />End Sub<br />
8. 8.
9. 9.
10. 10. Private Sub BtOK_Click()<br />VarCurso = CxCadastro.CampoCurso<br />VarData = CxCadastro.CampoData<br />VarParticipante = CxCadastro.CampoParticipante<br />VarDepto = CxCadastro.CampoDepto<br />VarEmpresa = CxCadastro.CampoEmpresa<br />VarCusto = CxCadastro.CampoCusto<br /> Range("EntraCurso").Select<br />ActiveCell.FormulaR1C1 = VarCurso<br /> Range("EntraData").Select<br />ActiveCell.FormulaR1C1 = VarData<br /> Range("EntraParticipante").Select<br />ActiveCell.FormulaR1C1 = VarParticipante<br /> Range("EntraDepto").Select<br />ActiveCell.FormulaR1C1 = VarDepto<br /> Range("EntraEmpresa").Select<br />ActiveCell.FormulaR1C1 = VarEmpresa<br /> Range("EntraCusto").Select<br />ActiveCell.FormulaR1C1 = VarCusto<br />