Hi , I have tried several ways to put excel formula into a worksheet cell by vba code, but it is showing errors in each case. The formula is as follows:

=SUMIFS('Flock 11'!G4:G458,'Flock 11'!A4:A458," >= " &E2,'Flock 11'!A4:A458,"<= " &G2)

And a little description about the worksheets:

There are two worksheets, one is "Flock 11", from where the data would be retried and other is "Main" worksheet where the formula is going to be put in.

I am going to put the above formula in a cell of "Main" worksheet by vba code. That's why I have coded like below:

Cells(6, i).Value = "=SUMIFS('Flock 11'!G4:G458,'Flock 11'!A4:A458," & "" >= "" & "&E2," & "'Flock 11'!A4:A458," & "" <= "" & "&G2)"

But type miss match error is showing.

Any solution please!!!!!