
Basole
Membros-
Content Count
28 -
Joined
-
Last visited
Community Reputation
0 NeutroAbout Basole

Perfil
-
Gender
Male
-
Location
Sampa
Recent Profile Visitors
788 profile views
-
Poste o arquivo TXT que está importando
-
@[email protected] experimente colocar + duas aspas entre o caminho Exemplo: RetVal = Shell("""C:\Sistemas\NomePrograma_Zero\NomePrograma.BAT""", 1)
-
Fiz as alterações,mas não tive como testar, Veja se é isso e de retorno por favor. Sub Importar() Dim Abrir As String Dim Importarwb As Workbook Dim Importarguia As Worksheet Dim xlObj As Object On Error GoTo trataErro Set xlObj = CreateObject("excel.application") Abrir = Application.GetOpenFilename( _ FileFilter:="Arquivo do Excel (*.xls;*.xlsx;*.xlsm),*.xls;*.xlsx;*.xlsm", Title:="Escolha o arquivo a ser importado") Set Importarwb = xlObj.Workbooks.Open( _ Filename:=Abrir, Password:="123") Set Importarguia = Importarwb.Worksheets(1) Application.ScreenUpdating = False 'Desbloquear guia e pasta de trabalho ThisWorkbook.Unprotect ("123") ActiveSheet.Unprotect ("123") 'Copiar dados Importarguia.UsedRange.Copy 'Limpar guia "Relatório" e colar dados ThisWorkbook.Worksheets("Relatório").Visible = True With Worksheets("Relatório") .Activate .Range(.Cells(1, 1), .Cells(10000, 90)).ClearContents .Cells(1, 1).Select .Paste .Visible = False End With Importarwb.Application.CutCopyMode = False 'Fechar arquivo externo If Not Importarwb Is Nothing Then Importarwb.Close False Set Importarwb = Nothing Set xlObj = Nothing End If 'Bloquear guia e pasta de trabalho ThisWorkbook.Protect Password:="123", Structure:=True, Windows:=False Sheets("Base de Contratos").Protect Password:="123", _ DrawingObjects:=True, _ Contents:=True, _ Scenarios:=True, _ UserInterfaceOnly:=True, _ AllowFormattingCells:=False, _ AllowFormattingColumns:=False, _ AllowFormattingRows:=True, _ AllowInsertingColumns:=False, _ AllowInsertingRows:=True, _ AllowInsertingHyperlinks:=False, _ AllowDeletingColumns:=False, _ AllowDeletingRows:=True, _ AllowSorting:=False, _ AllowFiltering:=True, _ AllowUsingPivotTables:=False trataErro: Application.ScreenUpdating = True If Not Importarwb Is Nothing Then Importarwb.Close False Set Importarwb = Nothing Set xlObj = Nothing End If MsgBox "Relatório importado com sucesso!" End Sub
-
Segue un link com codigos e exemplos: http://www.onlinepclearning.com/add-previous-and-next-buttons-userform-excel-vba/#Userform_Previous_and_Next_Buttons
-
ERRO O OBJETO CHAMADO SE DESCONECTOU DE SEUS CLIENTES
Basole replied to walerysantos's question in VBA
Seria bom se pudesse anexar seu arquivo ou um exemplo próximo dele com alguns dados fictícios, para tentar entender melhor o que está acontecendo. -
Godinho VBA, post seu arquivo, ou um exemplo com alguns dados ficticios
-
Repare nesta linha do codigo -> linhalistbox = linhalisbox + 1 -> faltou um "t" (letra t) no segundo linhalistbox. Isto que esta causando o erro. Outra coisa, eu não gosto de usar Do Until = "" pois se por exemplo o loop encontar alguma linha vazia ele é encerrado e na carragar as demais linhas com dados. Fiz algumas alteraçoes: Sub Filtro_Acumulado() Dim UL As Long, linhalisbox As Integer linha = 1 With Me.LBOrcadoRealizado .ColumnCount = 4 .Clear .ColumnWidths = "80;70;70;80" With Sheets("BANCO_DE_DADOS") UL = .Cells(Rows.Count, 1).End(xlUp).Row End With For linha = linha To UL If Sheets("BANCO_DE_DADOS").Cells(linha, 1) <> "" Then .AddItem .List(linhalistbox, 0) = Sheets("BANCO_DE_DADOS").Cells(linha, 1) .List(linhalistbox, 1) = Sheets("BANCO_DE_DADOS").Cells(linha, 2) .List(linhalistbox, 2) = Sheets("BANCO_DE_DADOS").Cells(linha, 3) .List(linhalistbox, 3) = Sheets("BANCO_DE_DADOS").Cells(linha, 4) linhalistbox = linhalistbox + 1 'soma ela mesma, pula para próxima linha End If Next End With End Sub
-
Para que o evento seja acionado por alterações de valores com formulas, use o evento calculate. Veja o exemplo: Em um modulo padrão, declare as variaveis: Public iniVal1 As Variant Public iniVal2 As Variant Em qualquer celula coloque uma formula, por exemplo: em B1: =A1+1 Private Sub Worksheet_Calculate() If Range("H2").Value <> iniVal1 Or _ Range("H3").Value <> iniVal2 Then Application.EnableEvents = True Call CLASSIFICAÇÃOCALCULORS iniVal1 = Range("H2").Value iniVal2 = Range("H3").Value Application.EnableEvents = False End If End Sub
-
Poste aqui o seu modelo
-
Olá Mina seja bem vinda abordo! Pelo que estou vendo a celula "F2" já esta calculando o total, correto? Caso seja isso, então insira no evento Initialize : Private Sub UserForm_Initialize() Me.TextBox1.Text = Sheets("Nome_da_sua_Planilha(aba)").Range("F2").Value End Sub
-
Como eu faço para o Excel falar em português? É possível?
Basole replied to Elaine Melo's question in VBA
Com certeza. A opcao vc. enviar os links dos download e solicitar a ela instalar a nova linguagem. -
Como eu faço para o Excel falar em português? É possível?
Basole replied to Elaine Melo's question in VBA
Elaine dee uma olhada neste link : https://support.office.com/en-us/article/Using-the-Speak-feature-with-Multilingual-TTS-e522a4f2-37cb-492b-be6a-8997d23dfe70 -
Tente usar as " [ ] " ex.: [Desc Local de Trabalho]