Create data history

Guys, I hope this goes well!
I have a excel workbook by recording some data every day at the same place, but it is not a history, it is not time dependent. In column A (No. Contracts), column B (USPrevista), column C (USMedida), column D (USPendente). There are several lines, that is, several contracts, The column A is the same in all 4 sheets . Column B, C, and D are updated daily, however, a data history is not saved, the files are overlapped. They could improve a macro where the dates would be recorded in another part, as follows attach file?

Is it possible and can you help us?

Sub ds()
Dim contrato As String

Plan1.Select
ultcol = Plan2.Cells(2, 1).End(xlToRight).Column + 1

For i = 3 To Range("a3").End(xlDown).Row
    Plan1.Select
    contrato = Cells(i, 1).Value
' BD prevista
    Plan2.Select
    chave = 0
    For j = 3 To Range("a3").End(xlDown).Row
        If contrato = ActiveSheet.Cells(j, 1).Value Then
            ActiveSheet.Cells(j, 1).Select
            ActiveSheet.Cells(j, ultcol) = Plan1.Cells(i, 2)
            chave = 1
            Exit For
        End If
    Next
    If chave = 0 Then MsgBox "Não encontrei contrato em BD Prevista: " & contrato
' BD medida
    Plan3.Select
    chave = 0
    For j = 3 To Range("a3").End(xlDown).Row
        If contrato = ActiveSheet.Cells(j, 1).Value Then
            ActiveSheet.Cells(j, 1).Select
            ActiveSheet.Cells(j, ultcol) = Plan1.Cells(i, 3)
            chave = 1
            Exit For
        End If
    Next
    If chave = 0 Then MsgBox "Não encontrei contrato em BD Medida: " & contrato
' BD medida
    Plan4.Select
    chave = 0
    For j = 3 To Range("a3").End(xlDown).Row
        If contrato = ActiveSheet.Cells(j, 1).Value Then
            ActiveSheet.Cells(j, 1).Select
            ActiveSheet.Cells(j, ultcol) = Plan1.Cells(i, 4)
            chave = 1
            Exit For
        End If
    Next
    If chave = 0 Then MsgBox "Não encontrei contrato em BD Pendente:" & contrato
Next

Plan2.Cells(1, ultcol) = Plan1.Cells(1, 2)
Plan3.Cells(1, ultcol) = Plan1.Cells(1, 2)
Plan4.Cells(1, ultcol) = Plan1.Cells(1, 2)

Plan2.Cells(2, ultcol) = Plan1.Cells(2, 2)
Plan3.Cells(2, ultcol) = Plan1.Cells(2, 3)
Plan4.Cells(2, ultcol) = Plan1.Cells(2, 4)
Plan1.Select
MsgBox "Pronto, tudo copiado do dia " & Cells(1, 2)
End Sub
Workbook.xlsm
Chico JuniorAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
Você está dizendo que quer manter um histórico das mudanças diárias? Se sim, o que você gostaria de poder fazer com essa história?

A propósito, eu não falo português; Estou usando o Google Tradutor para traduzir o inglês para o português.


Are you saying that you want to keep a history of the daily changes? If so what would you like to be able to do with that history?

By the way I don’t speak Portuguese; I’m using Google Translate to translate English to Portuguese.
0
Chico JuniorAuthor Commented:
Sim, eu gostaria de usar esses valores registrados diariamente naquelas células para criar um gráfico para cada uma daquelas três variáveis e acompanhar a tendência.
Yes, I would like to use these daily recorded values in those cells to create a chart for each of those three variables and keep up with the trend.
Muito obrigado!
best regards
0
Martin LissOlder than dirtCommented:
When the 'ds' macro is run, I see that only column 'C' in the other 3 worksheets is changed and that column 'B' still says 22-Aug. Will 22-Aug always be there?

Quando a macro 'ds' é executada, vejo que apenas a coluna 'C' nas outras 3 planilhas é alterada e que a coluna 'B' ainda diz 22-Ago. O 22 de agosto sempre estará lá?
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Chico JuniorAuthor Commented:
Não, o dia 22-Ago na coluna B seria o registro feito nesta data, como exemplo. Gostaria que os dias subsequêntes fossem salvos lado a lado, junto com suas datas. Isto é, na coluna C, depois na coluna D e assim por diante.
No, the 22-Aug day in column B would be the record made on this date, as an example. I would like the subsequent days to be saved side by side, along with their dates. That is, column C, column D, and so on.
0
Martin LissOlder than dirtCommented:
Let me know if this is what you want. I also changed the code so that it doesn't 'Select' anything. 'Select' should be avoided whenever possible because the user could manually select something else while the code is running which would give unpredictable results.

Deixe-me saber se é isso que você quer. Eu também mudei o código para que ele não "selecione" nada. 'Select' deve ser evitado sempre que possível porque o usuário pode selecionar manualmente outra coisa enquanto o código está sendo executado, o que daria resultados imprevisíveis.
29116115.xlsm
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Chico JuniorAuthor Commented:
That's exactly what I want! Thanks for your help...
best regards
0
Martin LissOlder than dirtCommented:
You’re welcome and I’m glad I was able to help.

If you expand the “Full Biography” section of my profile you’ll find links to some articles I’ve written that may interest you.

Marty - Microsoft MVP 2009 to 2017
              Experts Exchange Most Valuable Expert (MVE) 2015, 2017
              Experts Exchange Top Expert Visual Basic Classic 2012 to 2017
              Experts Exchange Top Expert VBA (current)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.