Ir ao conteúdo
  • Cadastre-se

Ismael Souza

Membro Pleno
  • Posts

    36
  • Cadastrado em

  • Última visita

Tudo que Ismael Souza postou

  1. @AfonsoMiraObrigado pela resposta rápida ! Desconheço o VBS.
  2. Bom dia pessoal ! Tudo bem? Gostaria de solicitar ajuda para a seguinte ajuda : Preciso criar um agendamento para as call Call AbrirPlanoSop.AbrirSOP Call ArrumaPlano.Arruma Call Planejar.Plano Essas call devem rodar a cada duas semanas, toda sexta feira da segunda semana, sendo a primeiro semana (ou semana 1) , a semana do dia 03/01/2021, ou seja, 03/01/2021 à 09/01/2021 corresponde a semana 1, 10/01/2021 à 16/01/2021, corresponde a semana 2, na sexta feira dia 15/01/2021, eu deveria rodar essas calls. Eu nao tenho a minina ideia como criar uma macro agendando essas call Alguém poderia me ajudar com isso ? por favoor
  3. @Basole Não me expressei direto... O codigo abaixo é um agendamento, abre o arquivo (sUFile) as 6hs e deve fechar o mesmo que está aberto as 23hs. AbreArquivo = 6hs (o que você me ajudou com o sUFile FechaArquivo = 23hs (preciso burscar o arquivo com o mesmo nome do sUFile) Seria u Sub executa() Application.ScreenUpdating = False Application.DisplayAlerts = False Dim dayWeek As Integer dayWeek = Weekday(Date) If Not dayWeek = 6 Or dayWeek = 7 Then scheduleTime = nightTime If CInt(Hour(Now)) < nightTime Then ' Se ainda não é 23h Call scheduleVBA(scheduleTime) ' agenda execução para 23h Call AbreArquivo.AbrirPainel Exit Sub ' não tem motivo pra continuar... sai da macro Else ' Agora é 23h Call scheduleVBA(scheduleTime, stopSchedule) Call FechaArquivo.FechaPainel End If End If 'agenda execução para 6h scheduleTime = morningTime Call scheduleVBA(scheduleTime) Application.ScreenUpdating = True Application.DisplayAlerts = True End Sub entendeu?
  4. @Basole As 23 horas eu preciso atraves do "windows.activate" ir nesse arquivo que estara aberto e fechalo, mas ele estará com esse nome variável.. como faço isso?
  5. @Basole Levando em consideração o código abaixo em junção ao código que você propos, a String sUFile está ficando vazio na ultima parte do loop ! Fiz a depuração e não está funcionando, não abre nada por essa string ficar vazio ! Dim PathTgt As Variant PathTgt = ano & "\" & mes1 & ". " & mes & "\W" & semana & "\" & dia ' ex = '2021/1. JANEIRO/W2/01 Dim sFile As String Dim sUFile As String Dim sPath As String Dim dDLmd As Date Dim dUdDate As Date sPath = "\\105.103.12.249\OQC\11. PLANOS DIÁRIOS\3. PAINEL DE DEMANDA\" & PathTgt If VBA.Right(sPath, 1) <> "\" Then sPath = sPath & "\" sFile = VBA.Dir(sPath & "*.xlsm", VBA.vbNormal) If VBA.Len(sFile) = 0 Then Exit Sub End If Do While VBA.Len(sFile) > 0 If VBA.Left(sFile, 14) = "Painel Demanda_" Then dDLmd = VBA.FileDateTime(sPath & sFile) If dDLmd > dUdDate Then sUFile = sFile dUdDate = dDLmd End If End If sFile = VBA.Dir Loop If sUFile <> "" Then Workbooks.Open sPath & sUFile
  6. Alguem poderia me ajudar com o seguinte caso ? Com o código abaixo eu salvo um arquivo excel, em uma determinada pasta. Dim filePathName As String filePathName = rootPath1 & "\" & "Hardware Plan" & ".xlsm" If Dir(filePathName) = "" Then ActiveWorkbook.SaveCopyAs filePathName Else filePathName = rootPath1 & "\" & "Hardware Plan" & "_" & Format(Now(), "yyyymmwwddhhmmss") & ".xlsm" ActiveWorkbook.SaveCopyAs filePathName End If Depois com um outro arquivo eu tenho que que abrir esse arquivo mais atual salvo mas não estou conseguindo fazer isso. Poderiam me ajudar com um codigo que abre a planilha mais atual (filePathName = rootPath1 & "\" & "Hardware Plan" & "_" & Format(Now(), "yyyymmwwddhhmmss") & ".xlsm") dentro da pasta? Tambem, em um agendamento que tenho preciso ir até esse arquivo que está aberto e fechar, mas ele vai estar com o nome variado, não tenho ideia como fazer. Obrigado pessoal !
  7. Ola @InforMira Obrigado pela resposta ! Dim fso As Scripting.FileSystemObject Nessa definição, está aparecendo uma mensagem que que o tipo definição não foi definido Sendo abaixo o código completo : Sub AbrirPainel() Dim dia As String dia = Format(Day(Date), "00") Dim mes As String mes = UCase(Format(Date, "MMMM")) mes1 = Month(Date) Dim ano As String ano = Year(Date) Dim tgtDay As Integer Dim DayName As Variant tgtDay = Weekday(Date, [vbSunday]) Select Case tgtDay Case 1 Case 2 Dim DDS As String DDS = "MONDAY" DayName = DDS Case 3 Dim DDT As String DDT = "TUESDAY" DayName = DDT Case 4 Dim DDQ As String DDQ = "WED" DayName = DDQ Case 5 Dim DDQT As String DDQT = "THURSDAY" DayName = DDQT Case 6 Dim DDST As String DDST = "FRIDAY" DayName = DDST Case 7 Dim DDSB As String DDSB = "SATURDAY" DayName = DDSB End Select Dim semana As Variant semana = WorksheetFunction.IsoWeekNum(Date) Dim PathTgt As Variant PathTgt = ano & "\" & mes1 & ". " & mes & "\W" & semana & "\" & dia Dim sFldr As String Dim fso As Scripting.FileSystemObject Dim fsoFile As Scripting.File Dim fsoFldr As Scripting.Folder Dim dtNew As Date, sNew As String Const sCSVTYPE As String = "Microsoft Office Excel Comma Separated Values File" Set fso = New Scripting.FileSystemObject sFldr = "\\105.103.12.249\OQC\11. PLANOS DIÁRIOS\3. PAINEL DE DEMANDA\" & PathTgt Set fsoFldr = fso.GetFolder(sFldr) For Each fsoFile In fsoFldr.Files If fsoFile.DateLastModified > dtNew And fsoFile.Type = sCSVTYPE Then sNew = fsoFile.Path dtNew = fsoFile.DateLastModified End If Next fsoFile Workbooks.Open sNew Dim wbk As Workbook Set wbk = ActiveWorkbook With wbk Sheets("PAINEL DEMANDA").Select ActiveSheet.combobox1.Text = DayName End With End Sub Como posso resolver isso? Obrigado mais uma vez pela ajuda ! grande ajuda ! Erro: Tipo definido pelo usuário não definido
  8. Olá pessoal ! Alguem poderia me ajudar com o seguinte caso ? Com o código abaixo eu salvo um arquivo excel, em uma determinada pasta. Dim filePathName As String filePathName = rootPath1 & "\" & "Hardware Plan" & ".xlsm" If Dir(filePathName) = "" Then ActiveWorkbook.SaveCopyAs filePathName Else filePathName = rootPath1 & "\" & "Hardware Plan" & "_" & Format(Now(), "yyyymmwwddhhmmss") & ".xlsm" ActiveWorkbook.SaveCopyAs filePathName End If Depois com um outro arquivo eu tenho que que abrir esse arquivo mais atual salvo mas não estou conseguindo fazer isso. Poderiam me ajudar com um codigo que abre a planilha mais atual (filePathName = rootPath1 & "\" & "Hardware Plan" & "_" & Format(Now(), "yyyymmwwddhhmmss") & ".xlsm") dentro da pasta? Obrigado pessoal !
  9. olá pessoal ! Gostaria de uma ajuda, preciso selecionar o valor máximo de cada código com código VBA excel. Ex: A013, selecionar 12540 A125, selecionar 38170 Alguem poderiam me ajudar, por favor? Obrigado !
  10. Olá ! Pessoal, gostaria de solicitar ajuda a vocês para resolver o seguinte código: Dim iRn As Integer Dim rn, rng As String Do Until ActiveCell = "" rn = Mid(ActiveCell.Offset(0, 2).Value, 7, 4) & Mid(ActiveCell.Offset(0, 2).Value, 4, 2) & Mid(ActiveCell.Offset(0, 2).Value, 1, 2) rng = st4 & st3 & st2 iRn = ActiveCell.Rows.Count If ActiveCell.Offset(0, 3).Text = "FLAGSHIP" Then ElseIf rn < rng Then Selection.ListObject.ListRows(iRn).Delete ActiveCell.Offset(-1, 0).Select End If ActiveCell.Offset(1, 0).Select Loop A váriavel iRn está mostrando sempre com valor 1, preciso que me diga em que linha está para deletar a linha da tabela. alguem poderia me ajudar com isso por favor?
  11. Bom dia pessoal ! Tenho um userform com um textbox com o seguinte código : ] Private Sub IMEI_Exit(ByVal Cancel As MSForms.ReturnBoolean) If Me.IMEI = "" Then Exit Sub End If If ActiveSheet.Name = "LISTAS" Then Exit Sub End If ActiveSheet.Cells.Find("INSPETOR").Select If ActiveCell.Offset(1, 0) = "" Then ActiveCell.Offset(1, 0).Select ActiveCell.Value = Me.CombInsp.Value Else ActiveCell.End(xlDown).Select ActiveCell.Offset(1, 0).Select ActiveCell.Value = Me.CombInsp.Value End If ActiveSheet.Cells.Find("IMEI").Select If ActiveCell.Offset(1, 0) = "" Then ActiveCell.Offset(1, 0).Select ActiveCell.Value = Me.IMEI.Value Else ActiveCell.End(xlDown).Select ActiveCell.Offset(1, 0).Select ActiveCell.Value = Me.IMEI.Value End If ActiveSheet.Cells.Find("fert").Select If ActiveCell.Offset(1, 0) = "" Then ActiveCell.Offset(1, 0).Select ActiveCell.Value = Me.CombFert.Value Else ActiveCell.End(xlDown).Select ActiveCell.Offset(1, 0).Select ActiveCell.Value = Me.CombFert.Value End If ActiveSheet.Cells.Find("Block").Select If ActiveCell.Offset(1, 0) = "" Then ActiveCell.Offset(1, 0).Select ActiveCell.Value = Me.CombBlock.Value Else ActiveCell.End(xlDown).Select ActiveCell.Offset(1, 0).Select ActiveCell.Value = Me.CombBlock.Value End If ActiveSheet.Cells.Find("AP").Select If ActiveCell.Offset(1, 0) = "" Then ActiveCell.Offset(1, 0).Select ActiveCell.Value = Me.SWAP.Value Else ActiveCell.End(xlDown).Select ActiveCell.Offset(1, 0).Select ActiveCell.Value = Me.SWAP.Value End If ActiveSheet.Cells.Find("CP").Select If ActiveCell.Offset(1, 0) = "" Then ActiveCell.Offset(1, 0).Select ActiveCell.Value = Me.SWCP.Value Else ActiveCell.End(xlDown).Select ActiveCell.Offset(1, 0).Select ActiveCell.Value = Me.SWCP.Value End If ActiveSheet.Cells.Find("CSC").Select If ActiveCell.Offset(1, 0) = "" Then ActiveCell.Offset(1, 0).Select ActiveCell.Value = Me.SWCSC.Value Else ActiveCell.End(xlDown).Select ActiveCell.Offset(1, 0).Select ActiveCell.Value = Me.SWCSC.Value End If ActiveSheet.Cells.Find("HW VER").Select If ActiveCell.Offset(1, 0) = "" Then ActiveCell.Offset(1, 0).Select ActiveCell.Value = Me.SWHW.Value Else ActiveCell.End(xlDown).Select ActiveCell.Offset(1, 0).Select ActiveCell.Value = Me.SWHW.Value End If ActiveSheet.Cells.Find("MONTH").Select If ActiveCell.Offset(1, 0) = "" Then ActiveCell.Offset(1, 0).Select ActiveCell.Value = Me.MES.Value Else ActiveCell.End(xlDown).Select ActiveCell.Offset(1, 0).Select ActiveCell.Value = Me.MES.Value End If ActiveSheet.Cells.Find("WEEK").Select If ActiveCell.Offset(1, 0) = "" Then ActiveCell.Offset(1, 0).Select ActiveCell.Value = Me.WEEK.Value Else ActiveCell.End(xlDown).Select ActiveCell.Offset(1, 0).Select ActiveCell.Value = Me.WEEK.Value ActiveCell.Offset(0, 1).Value = Date End If Me.IMEI = "" me.imei.SetFocus End Sub O fato é que o Setfocus não se matem no textbox IMEI, poderiam me ajuda nesse caso por favor? A ideia é escanear um código de barras, com enter aumtomático, mas o setfocus se manter no textbox IMEI
  12. Bom dia pessoal ! Por favor, alguém teria um código para a seguinte necessidade ? Tenho um userform com TEXTBOX de 1 a 5, mas oTextbox5 só pode ficar habilitado somente quando os textbox1 ao textbox4 estiverem preenchidos. poderiam me ajudar com isso por favor?
  13. @Midori obrigado pela ajuda.. eu coloco numa Sub comum e chamo essa sub?
  14. Bom dia pessoal ! Alguém teria um código simples para que eu selecione uma sheet a cada um minuto, quando eu chegar na ultima volte pra sheet 1 ? Obrigadi
  15. Alguem pode me ajudar, por favorrrrrrrrrrrrr ?
  16. ola pessoal.. Na tabela em anexo tem um arquivo onde, tem um rawdata e na segunda aba tem o resumo, como fosse uma tabela dinamica.. Gostaria de pedir, qual o codigo que vocês usariam para fazer essa tabela da aba resumo, sem ser tabela dinamica... obrigado desde ja PLANO DE PRODUÇÃO.xlsx
  17. Ola @Midori ! O Código enviado por você criou uma pasta com o mes "JANEIRO" e não "AGOSTO". Como posso arrumar?
  18. Bom dia pessoal ! No code abaixo, estou criando pasta num diretorio, da seguinte maneira ano -> mes -> semana Mas o mes está em numero (ex: agosto = 08), qual a melhor maneira de adequar esse code para que ele crie a pasta com o nome "08.AGOSTO" e não só 08 ? Sub SalvaPlano() Dim WS As Worksheet Dim dia As String dia = Format(Day(Date), "00") + 1 Dim mes As String mes = Format(Month(Date), "00") Dim ano As String ano = Year(Date) Dim semana As Variant semana = WorksheetFunction.IsoWeekNum(Date) Dim rootPath, rootPath1, rootPath2, rootPath3, rootPath4 As Variant rootPath = "\\105.103.12.249\OQC\11. PLANOS DIÁRIOS" rootPath1 = rootPath & "\" & "HARDWARE" & "\" & ano If Dir(rootPath1, vbDirectory) = "" Then MkDir rootPath1 Obrigado pela atenção de todos
  19. Olá pessoal ! Tentando inserir a seguinte linha, o vba apresenta erro : Selection.Formula = _ "=SEERRO(SE(SOMASE('GMES PLAN'!$B:$B;B7;'GMES PLAN'!$D:$D)>0;SE($G$6>PROCV(C7;TABELAS!$K$2:$N$12;4;0);TABELAS!$I$3;SE($G$6>PROCV(C7;TABELAS!$K$2:$N$12;3;0);TABELAS!$H$3;TABELAS!$G$3));"");"")" Range(ActiveCell, ActiveCell.End(xlDown)).Select Eu preciso que seja essa fórmula na célula ativa, existe uma outra maneira de inserir ? Obrigado !
  20. Olá pessoal ! Por favor, alguém poderia me ajudar com o exemplo acima?
  21. Ola @Basole, ola pessoal. Estou enviando um exemplo do que comentei no ultimo post pra ver se consigo uma ajuda. Na planilha tem duas abas... uma chamada LOG e a outra HISTORICO. Ao atualizar a aba LOG eu preciso copiar a linha, com a figura e colar na aba historico com o mesmo formato Quando faço isso com codigos simples, o formato original é perdido. poderiam me ajudar com isso? obrigado HISTORICO DE FALHAS.xlsx
  22. @Basole Os arquivos onde trabalho são criptografados, mesmo que eu coloque aqui, ninguem consegue abrir em outro PC, por isso pedi ajuda somente pelos exemplos, é possível criar algo com base no que foi descrito?
  23. Boa tarde pessoal ! Preciso de uma ajuda novamente sobre um método que desconheço. Num planilha A, preciso copiar o range("A2:T2"), mas no range("G2") e no range("i2") tem imagens inseridas. Como eu disse, preciso copiar todo esse range com as imagens, ir até uma planilha B, no range("A2") da planilha B e colar com a imagem no formato original. Se eu fizer isso de maneira comum, ao colar, as imagens perdem a formatação original. Preciso fazer o copiar e colar sem perder a formatação original. * não posso enviar o documento, onde trabalho não é permitido.

Sobre o Clube do Hardware

No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas comunidades sobre tecnologia do Brasil. Leia mais

Direitos autorais

Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais

×
×
  • Criar novo...

 

GRÁTIS: ebook Redes Wi-Fi – 2ª Edição

EBOOK GRÁTIS!

CLIQUE AQUI E BAIXE AGORA MESMO!