Ir para conteúdo
Fórum Script Brasil

gilbapg

Membros
  • Total de itens

    6
  • Registro em

  • Última visita

Sobre gilbapg

gilbapg's Achievements

0

Reputação

  1. Bom dia Estou programando VBA no excel de certo modo "simples" Consiste em conferir algumas condição que se for valida em todas as celulas então amco = "amco+1" Porém esta dando o "Erro de tempo de execução 13" na linha do começo da condição SE, das varias existentes Não sei mais o que fazer estou a dois dias tentando e não consigo uma solução, PS: A quantidade de IF e END IF esta coerente Segue a macro: Sub Atualiza() Dim i, j, p, q, amco, ampr, Cellule As Integer i = 2 j = 13 ampr = 0 amco = 0 Sheets("Input").Select p = Cells(Cells.Rows.Count, "A").End(xlUp).Row q = Cells(1, Cells.Columns.Count).End(xlToLeft).Column For i = 2 To p If Cells(i, 13) = "CO" Or "" Then 'Erro ocorre nesta linha If Cells(i, 14) = "CO" Or "" Then If Cells(i, 15) = "CO" Or "" Then If Cells(i, 16) = "CO" Or "" Then If Cells(i, 17) = "CO" Or "" Then If Cells(i, 18) = "CO" Or "" Then If Cells(i, 20) = "CO" Or "" Then If Cells(i, 22) = "CO" Or "" Then If Cells(i, 23) = "CO" Or "" Then If Cells(i, 24) = "CO" Or "" Then If Cells(i, 25) = "CO" Or "" Then If Cells(i, 26) = "CO" Or "" Then If Cells(i, 28) = "CO" Or "" Then If Cells(i, 29) = "CO" Or "" Then If Cells(i, 30) = "CO" Or "" Then If Cells(i, 31) = "CO" Or "" Then If Cells(i, 32) = "CO" Or "" Then If Cells(i, 33) = "CO" Or "" Then If Cells(i, 35) = "CO" Or "" Then If Cells(i, 37) = "CO" Or "" Then If Cells(i, 39) = "CO" Or "" Then If Cells(i, 41) = "CO" Or "" Then If Cells(i, 43) = "CO" Or "" Then If Cells(i, 45) = "CO" Or "" Then If Cells(i, 47) = "CO" Or "" Then If Cells(i, 49) = "CO" Or "" Then If Cells(i, 50) = "CO" Or "" Then If Cells(i, 52) = "CO" Or "" Then If Cells(i, 54) = "CO" Or "" Then If Cells(i, 55) = "CO" Or "" Then If Cells(i, 57) = "CO" Or "" Then If Cells(i, 58) = "CO" Or "" Then If Cells(i, 59) = "CO" Or "" Then If Cells(i, 60) = "CO" Or "" Then If Cells(i, 61) = "CO" Or "" Then If Cells(i, 62) = "CO" Or "" Then amco = amco + 1 End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If Next MsgBox "você ainda possui " & ampr & " e "& amco &" amostras " End Sub
  2. Criei uma variavel no modulo e usei ela como base nos demais UserForms Problema resolvido, apesar de não obter resposta posto aqui a resposta
  3. Bom dia galera Estou com uma duvida numa parte de programaçao Resumindo estou fazendo uma planilha de cadastro de ensaios E tenho um userform que chama o outro No userform1 tenho: Private wsRegister As Worksheet (planilha relativa) Public indexRegister As String (indice relativo por onde atualizo a planilha) Set wsRegister = ThisWorkbook.Worksheets("Database") (por exemplo) E assim trabalho com os arquivos relativo a planilha Database sem problema Porém ao pressionar um botao vou para uma outra userform, a userform2 E eu preciso importar nesta nova userform o valor do indexRegister da userform1 Isto quer dizer trocar de userform porém continua usando exatamente a mesma variavel que esta presente na userform1 Exemplo, na userform2: Private Sub LoadRegisterEnsaios() With wsRegister Me.cboxexemplo.Text = .Cells(indexRegister, colexemplo).Value End with End Sub Porém isto não da certo Sei que é simples porem não consigo avançar mais Obrigado, Gilberto
  4. Descobri o office atualizou algumas coisas do 2007 para o 2010 Uma delas é não possuir a atualização da conexão Jet Resolvi meu problema mudando a conexão para .Provider = "Microsoft.ACE.OLEDB.12.0" A titulo de curiosidade eu possuo o windows 7 64 bits Abraços
  5. Bom dia pessoal, Estou tendo um problema pois quando trabalhava com o Excel 2007 executava conexoes para visual basic e não tinha nenhum problema Porém agora com o 2010 em diante, tento abrir o mesmo arquivo e não estou conseguindo. ele me acusa um "Erro em tempo de execução 3706. Provedor não encontrado.." não sei mais o que fazer. já tentei pelas referências, etc mas não estou conseguindo. Um exemplo da compilação aonde funcionava no 2007 e não funciona mais no 2010 é esta funçao: Private Sub PopulaCidades() Dim conn As ADODB.Connection Dim rst As ADODB.Recordset Dim sql As String Set conn = New ADODB.Connection With conn .Provider = "Microsoft.JET.OLEDB.4.0" .ConnectionString = "Data Source=" & ThisWorkbook.FullName & ";Extended Properties=Excel 8.0;" .Open End With sql = "SELECT DISTINCT Cidade FROM [Fornecedores$]" Set rst = New ADODB.Recordset With rst .ActiveConnection = conn .Open sql, conn, adOpenDynamic, _ adLockBatchOptimistic End With Do While Not rst.EOF If Not IsNull(rst(0).Value) Then lstCidades.AddItem rst(0).Value End If rst.MoveNext Loop ' Fecha o conjunto de registros. Set rst = Nothing ' Fecha a conexão. conn.Close End Sub Obrigado, Gilberto
×
×
  • Criar Novo...