formulas

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Excel Training and help » Formulas

Formulas

resolvedResolved · Low Priority · Version Standard

Simon has attended:
Excel VBA Intro Intermediate course

Formulas

How do I imbed formulas into VBA macro code?

RE: Formulas

Hi Simon

Thankyou for your question

I am assuming that you want to use the functions that come as standard with Excel

These functions are called worksheet functions, and are child objects of the application object. The following code uses the sum function to add up a given range of cells and insert it into cell b31

Range("b31").Value = Application.WorksheetFunction.Sum("B2:B30")


All the standard functions can be accessed in this way

Hope this is useful

Regards

Stephen


 

Excel tip:

Sorting List Subtotals

If you find that you would prefer to show the items in a subtotalled list in a different order, eg ascending rather than descending, you can sort your list. To sort a subtotalled list, hide the detail rows and then sort the subtotal rows. When you sort a subtotalled list, the hidden detail rows are automatically moved with the subtotal rows.
IMPORTANT: If you do not hide the details rows before sorting a subtotalled list, your subtotals will be removed and all of the rows in your list will be reordered.

View all Excel hints and tips


Server loaded in 0.11 secs.