Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Diem Tran   on Jan 02 In MS Office Category.

  
Question Answered By: Lurleen Fischer   on Jan 02

To make a variable  available to all procedures in all the vba  modules
in a project, declare  the variable at module level by using the Public
keyword rather than Dim AND putting it before the first procedure in
a standard vba module. Eg:

Public myVariable as long

Re:"How would I put  into the cell  A11 the formula  = sum(A1:A10) using
VBA code?"

If you record a macro you'll get R1C1 type references which you can
adjust thus:

Worksheets("Sheet1").Range("A11").FormulaR1C1 = "=SUM(R[-10]C:R[-1]C)"

Easier to write and understand though, you could use A1 type refs:

Worksheets("Sheet1").Range("A11").Formula = "=SUM(A1:A10)"

Share: 

 

This Question has 5 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on newbie questions Or get search suggestion and latest updates.


Tagged: