I am trying to loop through the workbook, take some value and store in a different sheet. Below is my code. Keepp getting VBA Object Variable or With Block Variable not Set Error.
Can someone help me spot where is wrong?
Sub analysis()
Dim i As Integer
Dim ws As Worksheet
For i = 4 To 197
ws = ActiveWorkbook.Sheets(i)
ws.Cells(1, 9) = ìstandardevî
ws.Cells(2, 9) = Application.WorksheetFunction.StDev(Range("D3:D34"))
ActiveWorkbook.Sheets(4).Cells(2, 1) = ws.Cells(2, 1)
Sheets(4).Cells(2, 2) = ws.Cells(3, 8)
Sheets(4).Cells(2, 3) = ws.Cells(2, 9)
Next i
End Sub