0

Having issues linking the values from Workbook_1 to appear on Workbook_2. I am not seeing the syntax error. Set Capture line is flagged. Any help much appreciated.

Sub RecordData()
Dim NextTime As Date
Dim Interval As Double
Dim cel As Range
Dim Capture As Range

Application.StatusBar = "Recording Started"
Set Capture = Workbooks("Workbook_1.xlsm").Worksheets(“Dashboard”).Range("A22:B22") 'Capture this row of data from Workbook_1
With Worksheets("Log") 'Record the data from Workbook_1 on this sheet on Workbook_2
    Set cel = .Range("A2") 'First timestamp goes here
    Set cel = .Cells(.Rows.Count, cel.Column).End(xlUp).Offset(1, 0)
    cel.Value = Now
    cel.Offset(0, 1).Resize(Capture.Rows.Count, Capture.Columns.Count).Value = Capture.Value
End With
NextTime = Now + TimeValue("00:01:00")
Application.OnTime NextTime, "RecordData"
End Sub
mjac
  • 125
  • 11
  • 2
    What line is flagged? Do you actually have the smart quotes in `“Dashboard”`? They should be straight quotes. – BigBen May 28 '21 at 20:57
  • Oh man...good eye. You could be right....checking now. – mjac May 28 '21 at 20:59
  • Good lord. That was it. I stared at it for like 3hrs and didn't see that. It works now. So annoying thanks. – mjac May 28 '21 at 21:04
  • 1
    @BigBen I was staring at the line thinking I was going mad. `Application.Workbooks("Workbook_1.xlsm").Worksheets(1).Name = "Dashboard"` So why is it an error when I ask for `Workbooks("Workbook_1.xlsm").Worksheets(“Dashboard”).Name` ?! darn weird quotes. – Toddleson May 28 '21 at 21:04

0 Answers0