![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Posts: 97
|
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 |
|
BatCoder
Join Date: Feb 2002
Location: Turkey
Posts: 764
|
Are you sure you set Calculation to Manual from Tools_Options_Calculation? (assume you dont want auto calculation according to your explanations)
|
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Posts: 97
|
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 |
|
Legend
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
|
Hows about:
Range("A1:z40000").Calculate |
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Feb 2002
Posts: 97
|
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 |
|
Legend
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
|
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 |
|
Board Regular
Join Date: Feb 2002
Posts: 97
|
thanks Nate0
| |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|