I am very much a novice when it comes VBA for excel, I am currently working on a macro for a spread trading worksheet. The below if statement changes the value on the buy side, however the conditions are met to slowly and the value doesn't adjust quickly enough.
=IF(AND(H6=0,I68=0),D4,IF(AND(H6>0,H6<D4,I68=0),D4-H6,IF(AND(H6<0,H6>=-E4-F4,ISBLANK(L2)),H6*(-1),IF(H6<-E4-F4,-H6-E4-F4,IF(H6=D4,1,IF(H6>D4,1,IF(AND(H6=0,ISTEXT(I66),I68>0),D72,IF(AND(H6>0,H6<P5,ISTEXT(I66),I68>0),P5-H6,IF(AND(H6=P5,ISTEXT(I66)),D73,IF(AND(H6>P5,H6<P6,ISTEXT(I66)),P6-H6,IF(AND(H6=P6,ISTEXT(I66)),D74,IF(AND(H6>P6,H6<O7,ISTEXT(I66)),O7-H6,IF(AND(H6=D4,ISTEXT(I66),I68>0),1,IF(AND(H6+I68>D4,ISTEXT(I66),I68>0,H6>0),D4-H6,IF(AND(H6<-O3,H6>=-E4-F4,ISTEXT(L2)),H6*(-N2),1)))))))))))))))
I started writing a macro to perform the same function:
I am having a problem with the H6>=-E4-F4 and ISBLANK(L2), not 100% how this should be written in VBA to satisfy the condition.
Also wanted to know how to automate the process so that when I open the spreadsheet the macro runs on its own and if there was a way to improve the code.
Thanks for the assistance
Bookmarks