Você está na página 1de 19

Abrindo a Calculadora Abrindo Arquivo GetOpenFile Abrindo um arquivo atravs de uma Inputbox Abrindo uma planilha atravs de uma

Macro Bloquear VBProject Colocar Dois Pontos em TextBox Comando Find Comando para abrir internet Comando para executar o flash player

Comando Split
Como Usar SpinButton Confirmando antes de executar uma macro Cont Valores

Sub nome_da_macro()Application.ActivateMicrosoftApp Ind Dim QualArquivoQualArquivo = Application.GetOpenFilenam Dim Nome As StringSub Nome_da_Macro()Nome = InputBo Sub nome_da_macro()
W orkbooks.Open FileName:=c:\pas Sub BloquearVBProject() If Val(Application.Version) > 8 Th Private Sub Txt_Debito_KeyPress(ByVal KeyAscii As MSFor Private Sub Txt_Mat_Exit(ByVal Cancel As MSForms.Return ActiveWorkbook.FollowHyperlink "http://www.google.com" Plan1.ShockwaveFlash1.Play Dim cString As VariantDim val1 As StringDim val2 As Stringc Dim linha As IntegerPrivate Sub SpinButton1_SpinDown()If Public Sub SolicitandoConfirmao()
If MsgBox(Deseja Con Sub Cont_Valores()Dim Cont As IntegerDim i As IntegerCon

Controle Listbox
Copiando e colando com uma Macro Criando mais de uma pasta Criando um arquivo de texto Criando um campo de pesquisa em um form Criando um evento para determinar um tempo Criando um Item na barra de menus Criando uma pasta Desbloquear VBProject Deslocando para outra guia de planilha Desprotegendo uma planilha com senha Desprotegendo uma planilha com uma Macro

Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.Retu

Sub nome_da_macro()
Range(A1:A10).Copy
Range(B2).S Sub nome_da_macro()Dim fso, f,f1,f2,f3 Set fso = CreateO Sub nome_da_macro()Set fs = CreateObject("Scripting.FileS Dim Search As StringDim Searchlen As StringSearch$ = UC Public Sub Espere(ByVal QtdSegundos As Long)Static Incio Option ExplicitPrivate Sub add_menu() Dim NewItem As O

Sub nome_da_macro()Dim fso, f Set fso = CreateObject("S Sub DesbloquearVBProject() If Val(Application.Version) > 8 Sub nome_da_macro()
Sheets(Plan1).Select
Range(A1).S Sub nome_da_macro ()

Dim i As Integer, j As Integer, k As Sub nome_da_macro()
ActiveSheet.Unprotect password:=s

Enviando Email Pelo VBA


Erros Fatais em Planilhas Excluindo linhas repetidas Excluindo uma Aba sem confirmao

Sub Enviar()Dim Outlook As ObjectDim Email As ObjectDim P

Sub Erro_Fatal() senha = "EU" If Application.InputBox("D Sub exclui_repetidos()Sheets("Plan1").SelectCells(1, 1).Sele Sub excluir()Application.DisplayAlerts = FalseActiveWindow

Excluir Repetidos
Executando um UserForm Exemplo de Array Exemplo de loop Do While Exemplo de Vetor Exibindo as guias de planilha Exibindo o Nome da Plan Exibindo uma mensagem de saudao ao abrir a Planilha Fazendo uma soma atravs de uma InputBox Fazendo uma soma na mesma clula

Sub exclui_repetidos()Sheets("Plan1").SelectCells(1, 1).Selec

Sub nome_da_macro()UserForm1.showEnd Sub Sub pais_array()Dim array_pais(4) As StringDim cont As Int Sub SepararVendas()Application.ScreenUpdating = FalseRa Sub Vetor()Dim i As IntegerDim j As IntegerDim aRow As Int Sub nome_da_macro()ActiveWindow.DisplayWorkbookTabs Sub NomeDaPlan()MsgBox Plan1.NameEnd Sub Sub Auto_Open()MsgBox "Seja Bem Vindo " & [Plan1!a1] & Sub nome_da_macro()Dim Numero1 As IntegerDim Numero Option ExplicitPublic Valores As Variant, Interv As Range

Fechando o UserForm com a Tecla ESC


Fechando um UserForm Formatao Condicional

Private Sub UserForm_KeyPress(ByVal KeyAscii As MSForms.

Sub nome_da_macro()UserForm1.hideEnd Sub Sub Formatacao_Condicional()Do If ActiveCell.Value >=

Formulrio sem Caption Funo Tab com Enter


Funes de Calendar Impedindo Fechar pelo boto [X] Inserindo informao na prxima clula em branco Inserindo um efeito sonoro no excel Inserindo um relgio no excel Inserindo um texto na barra de status

Option ExplicitPrivate Type RECT Left As Long Top As Private Sub Form_Load() KeyPreview = TrueEnd SubPrivate S

Private Sub CommandButton1_Click()Dim DIA As StringDim Private Sub UserForm_QueryClose(Cancel As Integer, Clos Sub Nome_da_Macro ()Range("a1").SelectDo If IsEmpty(A Sub nome_da_macro()BeepEnd Sub Dim proximosegundo As DateSub aHora() proximosegund Sub nome_da_macro()Application.StatusBar = "Bom dia"En

Inserindo um Timer no excel Inserindo um valor em uma clula Inserindo um valor em uma clula usando InputBox Inserindo uma Foto no Excel Inserindo uma mensagem existente em uma clula qualquer Inserindo uma mensagem na tela Inserir itens em uma combobox Limpando uma seleo

Sub SetTime() Dim DownTime As Date DownTime = Now Sub nome_da_macro()


Range(A1).Value = Texto que apar Sub nome_da_macro()
Dim Texto As Strings
Chr(13) serve p Sub Nome_da_Macro()
Dim caminho As String
caminho = Ac Sub nome_da_macro()MsgBox [A1]End Sub Sub nome_da_macro()
MsgBox Esta a mensagem que ap Private Sub UserForm_Initialize()ComboBox1.AddItem "Car Sub nome_da_macro()
Range(A1:A10).Select
Selection.Cle

Mascara no Textbox Menu Suspenso


Mudando o Nome da Plan Ocultando as guias de planilha Ocultando o excel Parando o relgio Planilha Trial

Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.R Private Sub Workbook_BeforeClose(Cancel As Boolean)On E

Sub MudaNomeDaPlan()Plan1.Name = "Novo Nome"End S Sub nome_da_macro()ActiveWindow.DisplayWorkbookTabs Sub nome_da_macro() Application.Visible = FalseEnd Su Sub pararHora() On Error Resume Next Application.OnT Sub auto_open()MsgBox "ESTA UMA PLANILHA TRIAL, V

Procv no VBA
Protegendo uma planilha com uma Macro Retirando o texto da barra de status Salvando e fechando o excel ativo Salvando informaes de uma planilha em txt Salvando uma planilha Salvando uma planilha com outro nome Selecionar intervalo dentro de uma clula Senhas nas Abas da Planilha

Application.WorksheetFunction.VLookup(Arg1, Arg2, Arg3, A

Sub nome_da_macro()
ActiveSheet.Protect DrawingObjects Sub nome_da_macro()Application.StatusBar = falseEnd Su Sub nome_da_macro() ThisWorkbook.Save ThisWorkbo Sub SalvarArquivosTexto()'Voce escolhe o caracter separad Sub nome_da_macro()ActiveWorkbook.SaveEnd Sub Public Sub salvarpasta()Dim nome As Stringnome = InputBo Sub selecionar()range([e2]).SelectEnd Sub Private Sub Worksheet_Activate()Cells.Select Selection.E

Tirando Acento Trabalhando com Calendario


Usando If e Else Usando Select Case

Private Function TiraAcento(LetraAcentuada As String, TirarC Dim DIA As StringDim MES As StringDim ANO As StringDIA =

Public Sub TestIF()Dim Resp As StringResp = InputBox("Qu Dim Resp As StringResp = InputBox("Qual o seu time??",

acro()Application.ActivateMicrosoftApp Index:=0End Sub QualArquivo = Application.GetOpenFilename("Arquivos de texto (*.txt),*.txt", , "TUDO SOBRE EXCEL - Escolha o arquivo para Desproteger") 'Caixa de ngSub Nome_da_Macro()Nome = InputBox("Digite o nome", "aviso")' Verifica se campo est em brancoIf Nome = "" ThenExit SubEnd IfIf Nome <> "" acro()
W orkbooks.Open FileName:=c:\pasta1.xls
End Sub Project() If Val(Application.Version) > 8 Then SendKeys _ "%{F11}%fp^{TAB}%b{TAB}" & _ "SENHA" & "{TAB}" & "SENHA" & "{TAB}{ENT Debito_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)Txt_Debito.MaxLength = 5 If Len(Txt_Debito) = 2 Then Txt_Debito.Text = Txt_Debit Mat_Exit(ByVal Cancel As MSForms.ReturnBoolean)With Plan2.Range("A:A")Set C = .Find(Txt_Mat.Value, LookIn:=xlValues, LOOKAT:=xlWhole)If Not FollowHyperlink "http://www.google.com"

ariantDim val1 As StringDim val2 As StringcString = Split(Txt1.Text, ",")Txt2.Text = cString(0)Txt3.Text = cString(1)val1 = "0," & cString(1)val2 = val1 * 60 gerPrivate Sub SpinButton1_SpinDown()If linha = 1 Then Exit Sublinha = linha - 1UserForm1.TextBox1 = Sheets("Plan1").Cells(linha, 1)UserForm1.Tex andoConfirmao()
If MsgBox(Deseja Continuar?,vbYesNo) = vbNo Then
Exit Sub
End If
Aqui entra a macro caso seja clicado em sim.
End Sub s()Dim Cont As IntegerDim i As IntegerCont = 0range("a5").SelectFor i = 5 To 30 Step 1 Cells(i, 1).Select If IsEmpty(ActiveCell) = False Then

x1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)On Error Resume NextTextBox1.Text = ListBox1.TextTextBox2.Text = ListBox1.Column(1, Me.ListBo

acro()
Range(A1:A10).Copy
Range(B2).Select
ActiveSheet.Paste
End Sub acro()Dim fso, f,f1,f2,f3 Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.CreateFolder("c:\Nome da pasta") Set f1= fso.CreateFolde acro()Set fs = CreateObject("Scripting.FileSystemObject") Set a = fs.CreateTextFile("c:\Nome do arquivo.txt", True) a.WriteLine("Texto dentro do arq ringDim Searchlen As StringSearch$ = UCase$(txt_pesquisa.Text) Searchlen = Len(Search$) If Searchlen Then For i = 0 To List1.ListCount - 1 e(ByVal QtdSegundos As Long)Static Incio As Variant If Incio = 0 Then Incio = Time While DateDiff("s", Incio, Time) < QtdSegundos DoEvents vate Sub add_menu() Dim NewItem As Object, NewToolsItem As Object Set NewToolsItem = MenuBars(xlWorksheet).Menus.Add(Caption:="Bet

acro()Dim fso, f Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.CreateFolder("c:\Nome da pasta") CreateFolderDemo = f.PathEnd VBProject() If Val(Application.Version) > 8 Then SendKeys _ "%{F11}%fp^{TAB}%b{TAB}" & _ "{DEL}" & "{TAB}" & "{DEL}" & "{TAB}{ENT acro()
Sheets(Plan1).Select
Range(A1).Select
End Sub acro ()

Dim i As Integer, j As Integer, k As Integer
Dim l As Integer, m As Integer, n As Integer
On Error Resume Next
For i = 65 To 66
For j = 65 acro()
ActiveSheet.Unprotect password:=senha
End Sub

Outlook As ObjectDim Email As ObjectDim Pasta As WorkbookDim userInput As StringMsg = "Seguem os Relatrios, Tenha um bom dia!..."Set Outlook =

senha = "EU" If Application.InputBox("Digite a senha autorizada", "ABOWEB", "EU") = senha Then Else MsgBox "VOC NO E AUTORIZADO" dos()Sheets("Plan1").SelectCells(1, 1).SelectDim i As LongFor i = 1 To 65535Cells(i, 1).SelectIf Cells(i, 1) = "" ThenIf Cells(i + 1, 1) = "" ThenMsgBox "S cation.DisplayAlerts = FalseActiveWindow.SelectedSheets.DeleteApplication.DisplayAlerts = TrueEnd Sub

dos()Sheets("Plan1").SelectCells(1, 1).SelectDim i As LongFor i = 1 To 65535Cells(i, 1).SelectIf Cells(i, 1) = "" ThenIf Cells(i + 1, 1) = "" ThenMsgBox "Suces

acro()UserForm1.showEnd Sub Dim array_pais(4) As StringDim cont As IntegerFor cont = 1 To UBound(array_pais)array_pais(cont) = InputBox(" Coloque o nome de um pais: ")NextFo as()Application.ScreenUpdating = FalseRange("A2").SelectDo While ActiveCell <> ""Dim PlanilhaPlanilha = ActiveCellActiveCell.Range("B1:D1").Copy As IntegerDim j As IntegerDim aRow As IntegerDim aCol As IntegerDim Temp As IntegeraRow = 11aCol = Range("A1").ColumnFor i = 1 To aRow Step acro()ActiveWindow.DisplayWorkbookTabs = TrueEnd Sub n()MsgBox Plan1.NameEnd Sub MsgBox "Seja Bem Vindo " & [Plan1!a1] & " !!!" End Sub acro()Dim Numero1 As IntegerDim Numero2 As IntegerNumero1 = InputBox("Digite o 1 Valor", "Ttulo da InputBox")Numero2 = InputBox("Digite o 2 V

blic Valores As Variant, Interv As Range

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) Set Interv = Range("A1:b

orm_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)If KeyAscii = 27 ThenUnload MeEnd IfEnd Sub


With Selection.Interior .ColorIndex = 3 .Pattern = xlSolid

acro()UserForm1.hideEnd Sub _Condicional()Do If ActiveCell.Value >= 247 Then

End With ActiveCell.Offset

vate Type RECT Left As Long Top As Long Right As Long Bottom As LongEnd TypePrivate Declare Function FindWindow Lib "user32" Alias _Load() KeyPreview = TrueEnd SubPrivate Sub form_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then KeyAscii = 0: SendKeys "{TAB}",True End IfEn

mandButton1_Click()Dim DIA As StringDim MES As StringDim ANO As StringDIA = Calendar1.DayMES = Calendar1.MonthANO = Calendar1.YearMsg Form_QueryClose(Cancel As Integer, CloseMode As Integer)
' Evita que o usurio feche a tela no 'x' na tela
If CloseMode = vbFormControlMenu Then acro ()Range("a1").SelectDo If IsEmpty(ActiveCell) = False Then ActiveCell.Offset(1, 0).Select End If Loop Until IsEmpty(ActiveCell) = TrueActiv acro()BeepEnd Sub ndo As DateSub aHora() proximosegundo = Now + TimeValue("00:00:01") Application.OnTime proximosegundo, "aHora" UserForm1.TextBox1.Te acro()Application.StatusBar = "Bom dia"End Sub

Dim DownTime As Date DownTime = Now + TimeValue("00:00:05") Ao a ser executadaEnd Sub acro()
Range(A1).Value = Texto que aparecer na clula
End Sub acro()
Dim Texto As Strings
Chr(13) serve para que a mensagem aparea em duas linhas
Texto = InputBox(Introduzir um Texto & Chr(13) & Texto da 2 acro()
Dim caminho As String
caminho = ActiveCell.Offset(0, 2)
ActiveSheet.Shapes("Foto").Select
Selection.ShapeRange.Fill.UserPicture caminho
Rang acro()MsgBox [A1]End Sub acro()
MsgBox Esta a mensagem que aparecer na tela , VbOkOnly , Este o ttulo da mensagem
End Sub Form_Initialize()ComboBox1.AddItem "Carlos Henrique"ComboBox1.AddItem "Carlos"ComboBox1.AddItem "Cludio"ComboBox1.AddItem "Fbio"Com acro()
Range(A1:A10).Select
Selection.ClearContents
End Sub

ox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)Textbox1.MaxLength = 5 If Len(Textbox1) = 2 Then Textbox1.Text = Textbox1.Text & ":" book_BeforeClose(Cancel As Boolean)On Error GoTo erroApplication.CommandBars("cell").Controls("MENSAGEM").DeleteApplication.CommandBars("c

aPlan()Plan1.Name = "Novo Nome"End Sub acro()ActiveWindow.DisplayWorkbookTabs = FalseEnd Sub acro() Application.Visible = FalseEnd Sub On Error Resume Next Application.OnTime EarliestTime:=proximosegundo, Procedure:="ahora", Schedule:=FalseEnd Sub MsgBox "ESTA UMA PLANILHA TRIAL, VOC PODE UTILIZA-LA POR 4 VEZES!!!"ActiveWorkbook.Sheets("plan1").ActivateRange("a1").SelectDo

sheetFunction.VLookup(Arg1, Arg2, Arg3, Arg4)

acro()
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, password:=senha
End Sub acro()Application.StatusBar = falseEnd Sub acro() ThisWorkbook.Save ThisWorkbook.CloseEnd Sub osTexto()'Voce escolhe o caracter separador!F = FreeFile(0)fname = InputBox("Entre com o Nome e Endereo Completo do Arquivo):", "ABOWEB", Th acro()ActiveWorkbook.SaveEnd Sub pasta()Dim nome As Stringnome = InputBox("Digite o Nome do Arquivo", "Salvando...")ActiveWorkbook.SaveAs nomeEnd Sub ange([e2]).SelectEnd Sub sheet_Activate()Cells.Select Selection.EntireRow.Hidden = TrueDim resp As Stringresp = InputBox("Digite a senha")If resp = "" Then Exit SubIf resp

TiraAcento(LetraAcentuada As String, TirarCedilha As Boolean) As String Select Case Asc(LetraAcentuada) Case 192 To 197: TiraAcento = "A" Case 20 Dim MES As StringDim ANO As StringDIA = Calendar1.DayMES = Calendar1.MonthANO = Calendar1.YearMsgBox "DATA:" & DIA & "/" & MES & "/" & AN

()Dim Resp As StringResp = InputBox("Qual o seu Time?")If Resp = "Corinthians" ThenMsgBox "Parabns Campeo!!!"ElseMsgBox "Continue Sofre ngResp = InputBox("Qual o seu time??", "TIME FAVORITO")Select Case Resp Case "Santos" MsgBox "Mais ou Menos!" Case "Goias" M

quivo para Desproteger") 'Caixa de Dialogo AbrirPlan1.Range("F2") = QualArquivo ThenExit SubEnd IfIf Nome <> "" Then ChDir "C:\Documents and Settings\Hacker\Desktop"Workbooks.Open Filename:=NomeEnd IfEnd Sub

"{TAB}" & "SENHA" & "{TAB}{ENTER}%af" End IfEnd Sub n Txt_Debito.Text = Txt_Debito.Text & ":" SendKeys "{End}", True End IfEnd Sub lValues, LOOKAT:=xlWhole)If Not C Is Nothing Then C.Activate ActiveCell.Offset(0, 19).Value = "AUDITADO"

Lbl_Super.Caption = ActiveC

1 = "0," & cString(1)val2 = val1 * 60Txtfinal.Text = cString(0) + Val(val2) n1").Cells(linha, 1)UserForm1.TextBox2 = Sheets("Plan1").Cells(linha, 2)UserForm1.TextBox3 = Sheets("Plan1").Cells(linha, 3)UserForm1.TextBox4 = so seja clicado em sim.
End Sub mpty(ActiveCell) = False Then Cont = Cont + 1 End IfNext range("b2").Value = Cont + 4End Sub

ext = ListBox1.Column(1, Me.ListBox1.ListIndex)TextBox3.Text = ListBox1.Column(2, Me.ListBox1.ListIndex)TextBox4.Text = ListBox1.Column(3, Me.ListBo

a pasta") Set f1= fso.CreateFolder("c:\Nome da pasta") Set f2= fso.CreateFolder("c:\Nome da pasta") Set f3= fso.CreateFolder("c:\Nome da pasta") a.WriteLine("Texto dentro do arquivo.") a.CloseEnd Sub For i = 0 To List1.ListCount - 1 If UCase$(Left$(List1.List(i), Searchlen)) = Search$ Then List1.ListIndex = i Exit For End If Next E me) < QtdSegundos DoEvents ' faa outras coisas enquanto espera ' se cruzar a meia-noite, volte um dia (86400 segundos) If DateDiff("s", ksheet).Menus.Add(Caption:="Bethoven") Set NewItem = MenuBars(xlWorksheet) _ .Menus("Bethoven").MenuItems.Add(Caption:="Creditos"

) CreateFolderDemo = f.PathEnd Sub & "{TAB}" & "{DEL}" & "{TAB}{ENTER}%af" End IfEnd Sub For k = 65 To 66
For l = 65 To 66
For m = 65 To 66
For i1 = 65 To 66

ext
For i = 65 To 66
For j = 65 To 66

For i2 = 65 To 6

enha um bom dia!..."Set Outlook = CreateObject("Outlook.Application")Set Email = Outlook.CreateItem(olMailItem)With Email .Attachments.Add "C:\D

Box "VOC NO E AUTORIZADO", vbCritical, "ABOWEB" FatalExit 1 End IfEnd SubPrivate Declare Sub FatalAppExit Lib "kernel32" Alias "FatalAp Cells(i + 1, 1) = "" ThenMsgBox "Sucesso!", vbInformation, "Qualquer coisa to com pressa"Exit SubEnd IfElseIf Cells(i, 1) = Cells(i + 1, 1) ThenCells(i,

ls(i + 1, 1) = "" ThenMsgBox "Sucesso!", vbInformation, "Qualquer coisa to com pressa"Exit SubEnd IfElseIf Cells(i, 1) = Cells(i + 1, 1) ThenCells(i, 1).Selec

oque o nome de um pais: ")NextFor Each pais In array_paisMsgBox paisNextEnd Sub ellActiveCell.Range("B1:D1").CopySheets(Planilha).SelectRange("A65536").End(xlUp).Offset(1, 0).PasteSpecialSheets("Vendas").SelectActiveCell.Off 1").ColumnFor i = 1 To aRow Step 1For j = i + 1 To aRow Step 1If Cells(i, aCol).Value > Cells(j, aCol).Value ThenTemp = Cells(i, aCol).ValueCells(i, aCo

Numero2 = InputBox("Digite o 2 Valor", "Ttulo da InputBox")

Range) Set Interv = Range("A1:b10", Cells(UsedRange.Rows.Count, 2)) 'Se quiser considerar outro intervalo que no o da coluna B inteira, 'mude

olid

End With ActiveCell.Offset(1, 0).Select

Else

If ActiveCell.Value >= 235 Then

With Selection.Interior

.ColorIndex = 6

.Pattern = xlS

on FindWindow Lib "user32" Alias "FindWindowA" ( _ 0: SendKeys "{TAB}",True End IfEnd Sub

ByVal lpClassName As String, _

ByVal lpWindowName As String) As LongPrivate

MonthANO = Calendar1.YearMsgBox "DATA:" & DIA & "/" & MES & "/" & ANO, vbOKCancel, "CONFIRMA A DATA SELECIONADA ?"End Sub eMode = vbFormControlMenu Then
MsgBox "Use o Boto Fechar!!!
Cancel = True
End If
End Sub
---------------------------------------------------

Outra F ntil IsEmpty(ActiveCell) = TrueActiveCell.Value = DateValue(TextBox1.Value) ActiveCell.Offset(0, 1) = ComboBox1.ValueEnd Sub UserForm1.TextBox1.Text = TimeEnd Sub

"aHora"

um Texto & Chr(13) & Texto da 2 linha , Ttulo da InputBox)


ActiveSheet.Range(A1).Value = Texto
ActiveSheet.Range("A1").Value = Numero1 + N nge.Fill.UserPicture caminho
Range("A1").Select
End Sub
Na Planilha, Na coluna 'A' coloque o nome do arquivo, na coluna B a extenso do arquivo e n

"ComboBox1.AddItem "Fbio"ComboBox1.AddItem "Luiz"ComboBox1.AddItem "Paulo"ComboBox1.AddItem "Roberto"ComboBox1.AddItem "Souza"C

box1.Text = Textbox1.Text & ":" SendKeys "{End}", TrueEnd Sub eleteApplication.CommandBars("cell").Controls("LIMPAR").DeleteExit Suberro:End SubPrivate Sub Workbook_Open()Dim NewControl As CommandBar

1").ActivateRange("a1").SelectDo

If IsEmpty(ActiveCell) = False Then

ActiveCell.Offset(1, 0).Select

End If

Loop Until IsEmpty(ActiveCell) = True

pleto do Arquivo):", "ABOWEB", ThisWorkbook.Path & "Teste.txt")fseparador = InputBox("Entre com o Caracter Separador:", "ABOWEB", ";")If fname <

meEnd Sub Cells.Select

")If resp = "" Then Exit SubIf resp = "10" Then

Selection.EntireRow.Hidden = FalseRange("a1").SelectElseMsgBox "senha incorreta"fim

To 197: TiraAcento = "A" Case 200 To 203: TiraAcento = "E" Case 204 To 207: TiraAcento = "I" Case 210 To 214: TiraAcento = "O" Case 217 To 220 TA:" & DIA & "/" & MES & "/" & ANO, vbOKCancel, "CONFIRMA A DATA SELECIONADA ?"
MsgBox "Ruim" Case "Corinthians"

o!!!"ElseMsgBox "Continue Sofrendo"End IfEnd Sub ou Menos!" Case "Goias" MsgBox "Legal" Case "Vila"

MsgBox "Esse bom!!!"End SelectEnd S

name:=NomeEnd IfEnd Sub

"

Lbl_Super.Caption = ActiveCell.Offset(0, 13).Value

Lbl_debito.Caption = Format(ActiveCell.Offset(0, 21).Value, "hh:mm")End IfIf C Is Nothing

ls(linha, 3)UserForm1.TextBox4 = Sheets("Plan1").Cells(linha, 4)End SubPrivate Sub SpinButton1_SpinUp()linha = linha + 1UserForm1.TextBox1 = Sh

xt = ListBox1.Column(3, Me.ListBox1.ListIndex)TextBox5.Text = ListBox1.Column(4, Me.ListBox1.ListIndex)TextBox6.Text = ListBox1.Column(5, Me.ListBox

CreateFolder("c:\Nome da pasta") CreateFolderDemo = f.Path CreateFolderDemo = f1.Path CreateFolderDemo = f2.Path CreateFolderDemo = f3

Exit For End If Next End If 6400 segundos) If DateDiff("s", Incio, Time) < 0 Then Incio = DateAdd("s", -86400, Incio) End If Wend Incio = 0 End Sub enuItems.Add(Caption:="Creditos", OnAction:="CreditsSub")End SubSub CreditsSub()MsgBox "legalll"End SubSub deletar_menu() On Error GoTo er

1 = 65 To 66

For i2 = 65 To 66

For i3 = 65 To 66

For i4 = 65 To 66

For i5 = 65 To 66

For i6 = 65 To 66

For

With Email .Attachments.Add "C:\Documents and Settings\TR003851\Desktop\01.htm" .Attachments.Add "C:\Documents and Settings\TR003851\De

pExit Lib "kernel32" Alias "FatalAppExitA" (ByVal uAction As Long, ByVal lpMessageText As String)Private Declare Sub FatalExit Lib "kernel32" (ByVal s(i, 1) = Cells(i + 1, 1) ThenCells(i, 1).SelectSelection.EntireRow.Deletei = i - 1End IfEnd IfNextEnd Sub

= Cells(i + 1, 1) ThenCells(i, 1).SelectSelection.EntireRow.Deletei = i - 1End IfEnd IfNextEnd Sub

ets("Vendas").SelectActiveCell.Offset(1, 0).SelectLoopRange("A2:D100").ClearRange("A1").SelectEnd Sub p = Cells(i, aCol).ValueCells(i, aCol).Value = Cells(j, aCol).ValueCells(j, aCol).Value = TempEnd IfNextNextEnd

no o da coluna B inteira, 'mude a linha acima. Ex.: Set Interv = Range("C2:C36") If Not Intersect(Target, Interv) Is Nothing Then

Valores = Interv

.ColorIndex = 6

.Pattern = xlSolid

End With

ActiveCell.Offset(1, 0).Select

Else

If ActiveCell.Value >= 223 Then

With Selection.Interior

owName As String) As LongPrivate Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _

(ByVal hWnd As Long, ByVal nInde

ELECIONADA ?"End Sub -----------------------------------


Outra Forma
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)

If MsgBox("Deseja sair?", vbYesNo
ValueEnd Sub

Range("A1").Value = Numero1 + Numero2


End Sub coluna B a extenso do arquivo e na coluna C a seguinte frmula: =EXT.TEXTO(CL("filename";A1);1;LOCALIZAR("[";CL("filename";A1);1)-1)&A1&

rto"ComboBox1.AddItem "Souza"ComboBox1.AddItem "Teofilo"End Sub

)Dim NewControl As CommandBarControlDim NewControl2 As CommandBarControlSet NewControl = Application.CommandBars("cell").Controls.Add

op Until IsEmpty(ActiveCell) = True

ActiveCell.Value = "1"Range("c1").SelectIf ActiveCell.Value = "4" ThenMsgBox "Planilha expirou"End IfIf ActiveCel

arador:", "ABOWEB", ";")If fname <> False Or fseparador <> False ThenOpen fname For Output As #FSet Rng = ActiveCell.CurrentRegionDebug.Print

ctElseMsgBox "senha incorreta"fim:Exit SubEnd IfEnd Sub

TiraAcento = "O" Case 217 To 220: TiraAcento = "U" Case 224 To 229: TiraAcento = "a" Case 232 To 235: TiraAcento = "e" Case 236 To 239: TiraAc

x "Esse bom!!!"End SelectEnd Sub

alue, "hh:mm")End IfIf C Is Nothing ThenMsgBox "Matricula nao encontrada!!!"End IfEnd WithEnd Sub

nha + 1UserForm1.TextBox1 = Sheets("Plan1").Cells(linha, 1)UserForm1.TextBox2 = Sheets("Plan1").Cells(linha, 2)UserForm1.TextBox3 = Sheets("Pl

xt = ListBox1.Column(5, Me.ListBox1.ListIndex)End SubPrivate Sub UserForm_Initialize()ListBox1.ColumnWidths = "1 cm; 2 cm; 1,5 cm; 4 cm; 6 cm; 2 cm

= f2.Path CreateFolderDemo = f3.PathEnd Sub

Incio = 0 End Sub eletar_menu() On Error GoTo erroMenuBars(xlWorksheet).Menus("Bethoven").DeleteExit Suberro:MsgBox "O Item j foi deletado!", vbInformation, "

For i6 = 65 To 66

For n = 32 To 126
ActiveSheet.Unprotect Chr(i) & Chr(j) & Chr(k) & _
Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) &

ments and Settings\TR003851\Desktop\02.htm" .Attachments.Add "C:\Documents and Settings\TR003851\Desktop\03.htm" .Attachments.Add "C:\


senha = "EU"

ub FatalExit Lib "kernel32" (ByVal code As Long)Sub Erro_Fatal_Personal()

If Application.InputBox("Digite a senha autorizada", "ABO

s Nothing Then

Valores = Interv End IfEnd SubPrivate Sub Worksheet_Change(ByVal Target As Excel.Range) Dim Lin As Long, Col As Long If No

Then

With Selection.Interior

.ColorIndex = 36

.Pattern = xlSolid

End With

ActiveCell.Offset(1, 0).Select

Else

If ActiveCell.Value > 0 Th

(ByVal hWnd As Long, ByVal nIndex As Long) As Long

Private Declare Function SetWindowLong _

Lib "user32" Alias "SetWindowLongA

f MsgBox("Deseja sair?", vbYesNo + vbQuestion + vbDefaultButton2, "Chatice") = vbNo Then Cancel = 1


End Sub

("[";CL("filename";A1);1)-1)&A1&"."&B1
Coloque um Quadro na Tela (Barra de Ferramentas Desenho) e Nomeie o quadro como Foto

Ento associe a

ommandBars("cell").Controls.Add With NewControl

.Caption = "MENSAGEM"

.OnAction = "chamar"

.BeginGroup = True

.FaceId = 351

Planilha expirou"End IfIf ActiveCell.Value <> 4 ThenMsgBox "voc ainda tem " & [e1] & " utilizaes!!"End IfEnd Sub

veCell.CurrentRegionDebug.Print Rng.Address 'janela ImediataFCol = Rng.Columns(1).ColumnLCol = Rng.Columns(Rng.Columns.Count).ColumnFr

nto = "e" Case 236 To 239: TiraAcento = "i" Case 242 To 246: TiraAcento = "o" Case 249 To 252: TiraAcento = "u" Case 199:

If TirarCedilha = Tru

UserForm1.TextBox3 = Sheets("Plan1").Cells(linha, 3)UserForm1.TextBox4 = Sheets("Plan1").Cells(linha, 4)End SubPrivate Sub UserForm_Initialize()

m; 2 cm; 1,5 cm; 4 cm; 6 cm; 2 cm "End Sub

m j foi deletado!", vbInformation, "Aviso!!"End SubSub Chamar_menu()Call add_menuEnd Sub

(m) & Chr(i1) & Chr(i2) & Chr(i3) & _


Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
If ActiveSheet.ProtectContents = False Then
MsgBox "A Senha foi qu

p\03.htm" .Attachments.Add "C:\Documents and Settings\TR003851\Desktop\04.htm" .To = "bethoven07@gmail.com" .CC = "bethovenx@msn.com


Else FatalAppExit 0, "ACESSO NO PERMITIDO, DESCULPE!" End IfEnd Sub

("Digite a senha autorizada", "ABOWEB", "EU") = senha Then

im Lin As Long, Col As Long If Not Intersect(Target, Interv) Is Nothing Then

If Target.Cells.Count > 1 Then

MsgBox "Selecione e altere apenas um

Else

If ActiveCell.Value > 0 Then

With Selection.Interior

.ColorIndex = 4

.Pattern = xlSolid

End With

ActiveCell.Offset(1, 0).Select

"user32" Alias "SetWindowLongA" (ByVal hWnd As Long, _

ByVal nIndex As Long, ByVal dwNewLong As Long) As LongPrivate Declare Function

quadro como Foto


Ento associe a um boto, coloque o cursor sobre o nome e clique no boto que a fotografia ir aparecer no quadro criado.

A fotog

ginGroup = True

.FaceId = 351 End WithSet NewControl2 = Application.CommandBars("cell").Controls.Add With NewControl2

.Caption = "LIM

ns(Rng.Columns.Count).ColumnFrow = Rng.Rows(1).RowLrow = Rng.Rows(Rng.Rows.Count).RowFor i = Frow To LrowoutputLine = ""For j = FCol To

Case 199:

If TirarCedilha = True Then

TiraAcento = "C"

Else

TiraAcento = ""

End If Case 231:

If TirarCedilha = True Then

TiraA

bPrivate Sub UserForm_Initialize()linha = 2UserForm1.TextBox1 = Sheets("Plan1").Cells(linha, 1)UserForm1.TextBox2 = Sheets("Plan1").Cells(linha, 2)

Then
MsgBox "A Senha foi quebrada com sucesso
Exit Sub
End If

Next

Next

Next

Next

Next

Next

om" .CC = "bethovenx@msn.com" .BCC = "" .Subject = ActiveWorkbook.Name .Body = Msg .sendEnd WithSet Email = Nothing 'Limpa a memriaS
DESCULPE!" End IfEnd Sub

Box "Selecione e altere apenas uma clula de cada vez", vbExclamation, "Ateno"

Exit Sub

End If

Lin = Target.Row - Interv.Cells(1, 1).Row + 1

ActiveCell.Offset(1, 0).Select

Else

If ActiveCell.Value = Empty Then

Exit Sub

End If

End If

End If

End If

End If

Loop Until Acti

) As LongPrivate Declare Function DrawMenuBar Lib "user32" ( _

ByVal hWnd As Long) As LongPrivate Function BarraTtuloUserForm(bState As

aparecer no quadro criado.


A fotografia deve estar na mesma pasta da planilha para funcionar.

h NewControl2

.Caption = "LIMPAR"

.OnAction = "chamar"

.BeginGroup = True

.FaceId = 351 End WithEnd Sub

rowoutputLine = ""For j = FCol To LColIf j <> LCol ThenoutputLine = outputLine & Cells(i, j) & fseparadorElseoutputLine = outputLine & Cells(i, j)End IfN

TirarCedilha = True Then

TiraAcento = "c"

Else

TiraAcento = ""

End If Case Else: TiraAcento = LetraAcentuada End SelectEnd FunctionPr

2 = Sheets("Plan1").Cells(linha, 2)UserForm1.TextBox3 = Sheets("Plan1").Cells(linha, 3)UserForm1.TextBox4 = Sheets("Plan1").Cells(linha, 4)End Su

Next

Next

Next

Next

Next

Next
Next
Next
Next
End Sub

Email = Nothing 'Limpa a memriaSet Outlook = Nothing 'Limpa a memriaEnd Sub

et.Row - Interv.Cells(1, 1).Row + 1

Col = Target.Column - Interv.Cells(1, 1).Column + 1

If IsNumeric(Valores(Lin, Col)) And IsNumeric(Target.Value

d If

End If

Loop Until ActiveCell.Select = Empty Exit Sub End Sub

on BarraTtuloUserForm(bState As Boolean) Dim Userform_hWnd As Long Dim Userform_Style As Long Dim Userform_Rect As RECT Const GWL_STYL

ithEnd Sub

ne = outputLine & Cells(i, j)End IfNext jPrint #F, outputLineNext iClose #FEnd IfMsgBox "Backup Efetuado"End Sub

entuada End SelectEnd FunctionPrivate Sub Text1_KeyPress(KeyAscii As Integer) KeyAscii = Asc(TiraAcento(Chr(KeyAscii), False))End Sub

ets("Plan1").Cells(linha, 4)End Sub

Col)) And IsNumeric(Target.Value) Then

Application.EnableEvents = False

Target.Value = Target.Value + Valores(Lin, Col)

Application.

m_Rect As RECT Const GWL_STYLE = (-16) Const WS_CAPTION = &HC00000 Userform_hWnd = FindWindow( _

lpClassName:=IIf(Val(Application.Ver

cii), False))End Sub

Valores(Lin, Col)

Application.E

ClassName:=IIf(Val(Application.Version

Você também pode gostar