Macro enters formula but it won't calculate!

G

Guest

Sub FORMULA()
'
' FORMULA Macro
' Macro recorded 1/16/2006 by E127232 (James Kendall)
'
ActiveCell.FormulaR1C1 =
"=IF(AND(OR(CODE(B2)<47,CODE(B2)>58),RIGHT(B2,1)=""X"",LEN(B2)=6),CONCATENATE(0,B2),IF(AND(LEN(B2)=5,CODE(B2)>47,CODE(B2)<58,RIGHT(B2,1)<>""X"",ISERROR(FIND(""-"",B2))),CONCATENATE(0,B2),B2))"
Range("A2").Select
End Sub

This above gives me the following in a cell. I need it to calculate instead.
=IF(AND(OR(CODE(B2)<47,CODE(B2)>58),RIGHT(B2,1)="X",LEN(B2)=6),CONCATENATE(0,B2),IF(AND(LEN(B2)=5,CODE(B2)>47,CODE(B2)<58,RIGHT(B2,1)<>"X",ISERROR(FIND("-",B2))),CONCATENATE(0,B2),B2))

Am I missing something?
 
Z

Zack Barresse

Hello James,

What exactly is showing in the cell? Is it just not calculating? Press F9
to check. If it calculates pressing that key, you may have calculation set
to manual (Tools | Options | Calculation | Automatic). And take "Formula
R1C1" and change to "Formula".

HTH
 
B

Bob Phillips

Do you mean that you want

ActiveCell.Value = Activesheet.Evaluate( _
"=IF(AND(OR(CODE(B2)<47,CODE(B2)>58),RIGHT(B2,1)=""X"",LEN(B2)=6),CONCATENAT
E(0,B2),IF(AND(LEN(B2)=5,CODE(B2)>47,CODE(B2)<58,RIGHT(B2,1)<>""X"",ISERROR(
FIND(""-"",B2))),CONCATENATE(0,B2),B2))")


--
HTH

RP
Zack Barresse said:
Hello James,

What exactly is showing in the cell? Is it just not calculating? Press F9
to check. If it calculates pressing that key, you may have calculation set
to manual (Tools | Options | Calculation | Automatic). And take "Formula
R1C1" and change to "Formula".

HTH

--
Regards,
Zack Barresse, aka firefytr, (GT = TFS FF Zack)
To email, remove the NO SPAM. Please keep correspondence to the board, as
to benefit others.


James Kendall said:
Sub FORMULA()
'
' FORMULA Macro
' Macro recorded 1/16/2006 by E127232 (James Kendall)
'
ActiveCell.FormulaR1C1 =
"=IF(AND(OR(CODE(B2)<47,CODE(B2)>58),RIGHT(B2,1)=""X"",LEN(B2)=6),CONCATENAT
E(0 said:
Range("A2").Select
End Sub

This above gives me the following in a cell. I need it to calculate
instead.
=IF(AND(OR(CODE(B2)<47,CODE(B2)>58),RIGHT(B2,1)="X",LEN(B2)=6),CONCATENATE(0
 
G

Guest

Sorry guys. Evidently I was missing something (my brain).
I used formatting of Text to Columns earlier. It inserted the formula as a
text string due the the formatting. Once I had the macro reformat the text
to general everything worked fine.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top