execute formula

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

Wy doesn't this sub works? I get "VÄRDEFEL!" (faild value) in Swedish
The formula works in excel after F2 and Enter

Sub Sum()

myCol = "F"
myFirstCell = myCol & "7"
myLastCell = myCol & "24"
myArea = myFirstCell & ":" & myLastCell
mySumCell = myCol & "27"
Range(mySumCell).Activate
txt = "=SUM(" & myArea & ")"
ActiveCell.Formula = txt
ActiveCell.Calculate

End Sub
 
I copied and pasted your code, it works fine, where did you place the code
and what data do you have in F7:F24?
 
Hi,

Wy doesn't this sub works? I get "VÄRDEFEL!" (faild value) in Swedish
The formula works in excel after F2 and Enter

Sub Sum()

myCol = "F"
myFirstCell = myCol & "7"
myLastCell = myCol & "24"
myArea = myFirstCell & ":" & myLastCell
mySumCell = myCol & "27"
Range(mySumCell).Activate
txt = "=SUM(" & myArea & ")"
ActiveCell.Formula = txt
ActiveCell.Calculate

End Sub

This works fine in Excel 2000 (9.0.6926 SP-3)
Cell F27 ends up =SUM(F7:F24)

Try building the formula by hand in cell F27, or stepping through your
function in the visual basic debugger. There may be some variance
from your version of Excel to mine.

Brian Herbert Withun
 

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

Back
Top