+ Reply to Thread
Results 1 to 3 of 3

Calculate a range?

Hybrid View

  1. #1
    Registered User
    Join Date
    09-21-2006
    Posts
    35

    Calculate a range?

    Is there a way to calculate just a specific range but not the rest of a worksheet? I'd like to do this to save a lot of time with a large file.........

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Madmanmac,

    Use the Range object and the Calculate method. Here are a few examples. The example assumes Worksheet1 is the active sheet...

    'Calculate a given range of cells
      Range("A1:A50").Calculate
    
    'Calculate an entire row
      Range.Row(5).Calculate
    
    'Calculate an entire column
      Range.Column("D").Calculate
    Sincerely,
    Leith Ross

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Madmanmac,

    Creating and installing macros isn't really so difficult. This macro will allow you to calculate a given range on your worksheet. You can use this macro just like any other worksheet function.

    Installing the Macro:
    1) Print these directions for easier reference
    2) Copy the macro code below by using CTRL+C
    3) Open the workbook you want the macro to run in
    4) Press ALT+F11 to open the Visual Basic Editor (VBE)
    5) Press ALT+I to display the Insert drop down menu
    6) Press M to insert a Standard VBA module into the workbook
    7) Press CTRL+V to Paste the code into the module
    8) Press ALT+Q to close the VBE and return to Excel
    9) Press CTRL+S to save the macro in the workbook

    Macro Code:
    Public Function CalcRange(Worksheet_Cells As Range)
      Application.Volatile
      Worksheet_Cells.Calculate
      CalcRange = ""
    End Function
    Using it in the worksheet...
    Cell A1 formula: =CalcRange(A15:G50)

    Sincerely,
    Leith Ross

+ 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