R
Richard
Hi All,
I've got two problems writing a macro. I frequently to record the date
when I receive phone calls. Instead of typing yyyy.mm.dd, I'd like to
type, say, ctrl-/ and dd.
I like to use the macro as follows:
1. Whenever a new month occurs, I'll store the year and month in G2.
For this month, e.g., I'd store "2007.01." in G2.
2. Whenever I want to record a date sometime in this month, I'd click
the target cell and press Ctrl-/, and then dd to append today's day.
I'd like the macro to work as follows:
1. Store the current cell in, say, G3.
2. Make G2 the current cell.
3. Store G2's content by simulating Ctrl-C
4. Make the cell we started with the current cell
5. Paste the saved content by storing it in the current cell
The following script is my humble attempt at doing this. Is there an
easy way to achieve my scripting goal?
Sub CopyG2()
'
' CopyG2 Macro
' Macro recorded 1/20/2007 by RLMuller
'
'
Range("G2").Select
Selection.Copy
Range("D37").Select
ActiveSheet.Paste
Range("D37").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "2007.01."
Range("E37").Select
End Sub
Thanks in advance,
Richard
I've got two problems writing a macro. I frequently to record the date
when I receive phone calls. Instead of typing yyyy.mm.dd, I'd like to
type, say, ctrl-/ and dd.
I like to use the macro as follows:
1. Whenever a new month occurs, I'll store the year and month in G2.
For this month, e.g., I'd store "2007.01." in G2.
2. Whenever I want to record a date sometime in this month, I'd click
the target cell and press Ctrl-/, and then dd to append today's day.
I'd like the macro to work as follows:
1. Store the current cell in, say, G3.
2. Make G2 the current cell.
3. Store G2's content by simulating Ctrl-C
4. Make the cell we started with the current cell
5. Paste the saved content by storing it in the current cell
The following script is my humble attempt at doing this. Is there an
easy way to achieve my scripting goal?
Sub CopyG2()
'
' CopyG2 Macro
' Macro recorded 1/20/2007 by RLMuller
'
'
Range("G2").Select
Selection.Copy
Range("D37").Select
ActiveSheet.Paste
Range("D37").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "2007.01."
Range("E37").Select
End Sub
Thanks in advance,
Richard