Thanks Thanks:  0
Likes Likes:  0
Results 1 to 7 of 7

Thread: Calculate a Range

  1. #1
    Board Regular
    Join Date
    Feb 2002
    Posts
    97
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I want to write vba code to calculate a specific range of cells instead of the whole sheet. What I have done so far is selected the range in xl, and in the name box given that range a name. I then am trying to reference that range name in my code. But it doesn't seem to be calculating the whole range? Should I be creating a range object in my code and using it to reference the cells. Or maybe it's a problem with my code:
    Range("SimAvg").Calculate
    "SimAvg" being the range name I gave the cells in xl. I'm using xl2k.

  2. #2
    BatCoder
    Join Date
    Feb 2002
    Location
    Turkey
    Posts
    812
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default

    Are you sure you set Calculation to Manual from Tools_Options_Calculation? (assume you dont want auto calculation according to your explanations)




  3. #3
    Board Regular
    Join Date
    Feb 2002
    Posts
    97
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Yes, I actually have it in my code to manual calc. This spreadsheet contains a lot of formulas and makes a lot of calls to another app server, which would cause calcs everytime a call is made... ?

  4. #4
    Legend NateO's Avatar
    Join Date
    Feb 2002
    Location
    Minneapolis, Mn, USA
    Posts
    9,700
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hows about:

    Range("A1:z40000").Calculate




  5. #5
    Board Regular
    Join Date
    Feb 2002
    Posts
    97
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I realize I could hard code it that way, but I like to stay away from that. My question I guess is, can I reference a Cell Range I created in xl or do I have to create a Range object in my code?

  6. #6
    Legend NateO's Avatar
    Join Date
    Feb 2002
    Location
    Minneapolis, Mn, USA
    Posts
    9,700
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Maybe you need to reference the worksheet:

    Worksheets(Range("simavg").Worksheet.Name).Range("SimAvg").Calculate

    Does

    Worksheets(Range("simavg").Worksheet.Name).Range("SimAvg").select

    Take you to the appropriate range?

    _________________
    Cheers, NateO

    [ This Message was edited by: NateO on 2002-03-19 10:39 ]

  7. #7
    Board Regular
    Join Date
    Feb 2002
    Posts
    97
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    thanks Nate0
    |

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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