Invalid Formula Does not throw Error - VBA Excel 2010 64 bit -


i have project works fine excel 32 bit having problems running in 64 bit.

i have part handle invalid formulas (those things not evaluated excel.) 32 bit used throw error catch in 64 bit, seem have issues not sure of. code kinda got stucked.

sub macro1()     dim x variant     on error goto errh:     redim x(1, 1)     x(0, 0) = "=1+1"     x(0, 1) = "=1+ "  ' <--this sample of refer invalid formula     x(1, 0) = "=1+2"     x(1, 1) = "=1+1"       range("a1:b2").value = x  ' <--im stuck in part.                                ' program not proceed beyond point                                ' , not throw error used to.      'i here       on error goto 0    exit sub  errh:       ' have bunch of stuffs here, basically, error handling.   end sub 

what need excel throw error on line have indicated in code?

to validate formula, can use predifined function in vba

right(text,number of character) isnumber(text) 

dim integer :i=0 dim j integer :j=0

for = 0 1     j = 0 1         if isnumber(right(x(i,j),1)) or right(x(i,j),1)=")"         ' want if formula correct         else             goto errh:         end if     next next  

i don't think can output value of x using method x 2-d array.

range("a1:b2").value = x 

the proper way output use 2 loop

dim integer :i=0 dim j integer :j=0  = 0 1     j = 0 1     cells(i+1).value = x(i,j)     next next 

the error handling there may output message

errh:   msgbox "invalid formula"   exit sub 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -