I have the following formula in excel that I want to insert to my VBA code but do not know how to do it.
The formula should post to sheet(9).Range(Q9) and grab the info from sheet(25) from the cells specified in the formula. The word "resta" in the formula is a variable.

IF(AND(resta>$K$25,resta<$I$25),$G$25,
IF(AND(resta>$K$26,resta<$I$26),$G$26,
IF(AND(resta>$K$27,resta<$I$27),$G$27,
IF(AND(resta>$K$28,resta<$I$28),$G$28,
IF(AND(resta>$K$29,resta<$I$29),$G$29,
IF(AND(resta>$K$30,resta<$I$30),$G$30,
IF(AND(resta>$K$31,resta<$I$31),$G$31,
IF(AND(resta>$K$32,resta<$I$32),$G$32,
IF(AND(resta>$K$33,resta<$I$33),$G$33,
IF(AND(resta>$K$34,resta<$I$34),$G$34,
IF(AND(resta>$K$35,resta<$I$35),$G$35)))))))))))

Any suggestions would be appreciated.

Thanks