glennjrobertson1980
New Member
- Joined
- Mar 30, 2015
- Messages
- 12
Hi,
I have created some VBA code to run my spreadsheet. The code works perfectly.
However, I have a cell on a worksheet called "Data" the cell is D14 that I would like populated with the date and time that the macro started to run. I am struggling with this code. I have pasted my code below.
To confirm user has to start running macro manually I would like the above cell to populated to show the date and time that macro was started.
Many thanks in advance
Sub Macro1()
' This code will check all online SLM sites Pi data received. It will allow us
' to see when we last received comms with the unit.
With Application
.Calculation = xlCalculationManual
.MaxChange = 0.001
End With
For x = 1 To 311
Sheets("Data").Select
Cells(5, 4).Value = x
Calculate
Cells(23 + x, 6).Select
ActiveCell.FormulaR1C1 = "=R22C16"
Cells(23 + x, 7).Select
ActiveCell.FormulaR1C1 = "=R23C16"
Range(Selection, Selection.End(xlToLeft)).Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Next x
Range("B22").Select
MsgBox ("SLM Data Return V4 Calculations Complete")
End Sub
I have created some VBA code to run my spreadsheet. The code works perfectly.
However, I have a cell on a worksheet called "Data" the cell is D14 that I would like populated with the date and time that the macro started to run. I am struggling with this code. I have pasted my code below.
To confirm user has to start running macro manually I would like the above cell to populated to show the date and time that macro was started.
Many thanks in advance
Sub Macro1()
' This code will check all online SLM sites Pi data received. It will allow us
' to see when we last received comms with the unit.
With Application
.Calculation = xlCalculationManual
.MaxChange = 0.001
End With
For x = 1 To 311
Sheets("Data").Select
Cells(5, 4).Value = x
Calculate
Cells(23 + x, 6).Select
ActiveCell.FormulaR1C1 = "=R22C16"
Cells(23 + x, 7).Select
ActiveCell.FormulaR1C1 = "=R23C16"
Range(Selection, Selection.End(xlToLeft)).Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Next x
Range("B22").Select
MsgBox ("SLM Data Return V4 Calculations Complete")
End Sub