Hi there,
I'm baffled by a seemingly trivial problem in VBA, maybe I didn't define something? I was hoping ya'll can help shed light on this.
Basically, this code works:
But this code doesn't work?
It says runtime error 1004.
Am I missing something?
I'm baffled by a seemingly trivial problem in VBA, maybe I didn't define something? I was hoping ya'll can help shed light on this.
Basically, this code works:
Code:
Dim roster As Worksheet
With ThisWorkbook
Set roster = .Sheets.Add(After:=.Sheets(.Sheets.Count))
roster.Name = "Day shift"
End With
roster.Range("A1") = some value
But this code doesn't work?
Code:
Dim roster As Worksheet
With ThisWorkbook
Set roster = .Sheets.Add(After:=.Sheets(.Sheets.Count))
roster.Name = "Day shift"
End With
roster.Range(Cells(1, 1), Cells(1, 2)) = some value
It says runtime error 1004.
Am I missing something?