+ Reply to Thread
Results 1 to 3 of 3

Using Excel Formula in VBA

Hybrid View

  1. #1
    Registered User
    Join Date
    01-23-2006
    Posts
    35

    Using Excel Formula in VBA

    Hi,

    Can we use the excel formula in VBA directly without putting them on to worksheet.

    FOr example a formula to sum a range like =SUM(A1:A10). As of now I am putting this to a dummy cell through VBA code, then getting value back again from that.

    Now the question is : Can we use this SUM(A1:A10) formula directly in the code and get the value without pasting this formula to excel worksheet and get the summed value from that cell. Is there any method to achieve this.

    Please help. Thanks a lot in advance for the expert advice.

    Regards
    Anand

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    A couple of ways I can think of

    MsgBox WorksheetFunction.Sum(Range("A1:A3"))
    or

    MsgBox Evaluate("=sum(a1:a3)")
    rylo

  3. #3
    Registered User
    Join Date
    01-23-2006
    Posts
    35
    Hi Rylo,

    Thanks a lot for quick reply.

    Regards
    Anand

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1