INSERIR CARIMBO DE TEMPO (Insert a Timestamp)

Em virtude de ter recebido várias solicitações relacionadas com carimbos temporais, achei pertinente a publicação de um artigo sobre o assunto.
Because having received several requests related to timestamps, I found relevant to submit a post with this the subject.
Todos os dias temos necessidade de registar a data e/ou a hora actuais de um evento (agendamentos, registo de despesas, etc.). A estes registos chamam-se carimbos de tempo.
Every day we need to record the date and/or time of a current event (scheduling, expense registration, etc.). To these records we call timestamps.
Todavia, se tivermos de repetir o processo múltiplas vezes, torna-se aborrecido ter de reescrever constantemente a data e a hora.
However, if we repeat the process multiple times, it becomes boring and time consuming having to constantly rewrite the date and time.
Um modo de substituir a introdução manual data e/ou a hora actuais é utilizar as fórmulas HOJE() e AGORA().
A method of replacing the manual input of the current date and/or time is to use existing formulas TODAY() and NOW().
A primeira insere automaticamente a data actual. A segunda, além da data, insere também a hora.
The first automatically inserts the current date. The second enters the current date and time.
Exemplo:
Em A1, inserimos =HOJE(), obteremos a data actual (Ex. 24/11/2013 - podemos formatar a data como quisermos).
Em A2, inserimos =AGORA(), obteremos a data e hora actual (Ex. 24/11/2103 1:55 PM)
Example:
In A1, insert =TODAY(), we get the current date (eg. 11/24/2013 - format date as we wish).
In A2, insert =NOW(), we get the current date and time (eg. 11/24/2103 1:55 PM)
O problema da utilização destas fórmulas é que elas estão constantemente a actualizar o resultado. Ou seja, se no dia seguinte, às 10:00, abrirmos o ficheiro, A1 apresentará a data de 25/11/2013 e A2 terá o valor 25/11/2013 10:00 AM. Não servem por isso para criar registos de tempo que permitam uma análise posterior dos dados.
The problem of the use of these formulas is that they are constantly updating the result. That is, if the next day, at 10:00, we open the file, A1 will display the date of 11/25/2013 and A2 will have the value 11/25/2013 10:00 AM. Therefore they do not serve to create timestamps to allow further analysis of the data.
Para obtermos realmente um carimbo de tempo, temos de utilizar os seguintes atalhos de teclado:
1.    CTRL+SHIFT+; - Insere automaticamente a data actual
2.    CTRL+SHIFT+: - Insere automaticamente a hora actual
3.    CTRL+SHIFT+; ESPAÇO CTRL+SHIFT+: - Insere automaticamente a data e a hora actuais
To obtain a timestamp, we use the following keyboard shortcuts:
1.    CTRL+SHIFT+; - Automatically inserts the current date
2.    CTRL+SHIFT+: - Automatically inserts the current time
3.    CTRL+SHIFT+; SPACE CTRL+SHIFT+: - Automatically inserts the current date and time
Uma forma ainda mais rápida de escrever a data e a hora é substituir o atalho 3 por um atalho de teclado personalizado (ex: CTRL+t) associando-lhe a seguinte macro:
An even faster way to write the date and time is to replace the shortcut 3 for a custom keyboard shortcut (eg CTRL+t) and link the following macro:
Sub CarimboTempo()
Dim CT
'Atalho de Teclado (Keyboard Shortcut): Ctrl+t
CT = Format(Now, "dd/mm/yyyy hh:mm:ss AM/PM") ‘formatar como desejar (format as you wish)
ActiveCell.Select
Selection.NumberFormat = "dd/mm/yyyy hh:mm AM/PM" ‘formatar como desejar (format as you wish)
ActiveCell.Value = CT
End Sub
Onde escrever a macro
1.    Copiar o código acima
2.   Escolher no Friso Programador (*) -> Visual Basic ->



3.   Duplo click na Folha em que pretendemos correr a macro



4.   Colar o código
Como associar a macro a um atalho
5.   Escolher no Friso Programador (ou Ver) -> Macros -> Opções -> inserir CTRL+t
Where to place the macro
1.    Copy the code above
2.    In the Ribbon, choose Developer (*) > Visual Basic
3.    Double click on the sheet in which we intend to run the macro
4.    Paste the code
How to link the macro to a shortcut
5.    In the Ribbon, choose Developer (or View) > Macros > Options > Write CTRL+t



Comentários

Mensagens populares deste blogue

EXCEL 2007 - FUNÇÕES PARA CALCULAR HORAS (Functions to Calculate Hours)

CONVERTER HORAS EM DIAS DE TRABALHO (Convert Hours to Workdays)

VBA EXCEL - OCULTAR LINHAS EM BRANCO (Hide Blank Rows)