I would like to reference each sheet in this formula by specifying the sheet name with the variable, "sheetname". Does anyone know how to do this?
Sub PopulateRow()
Dim WS_Count As Integer
Dim I As Integer
Dim sheetname As String
WS_Count = ActiveWorkbook.Worksheets.Count
For I = 1 To WS_Count
Worksheets(I).Activate
sheetname = ActiveSheet.Name
Worksheets(1).Cells(I, 1).Formula = "=sum('sheetname'!d:d)"
Next I
End Sub