Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Function reading range with formulas

Function ParseCompList2(rangea As Range)
Dim lrangea as Variant
'Application.Calculate
'Application.Calculation = xlManual




lrangea = rangea.Resize(,1).Value

ParseCompList2 = lrangea(2,1)

'Application.Calculation = xlAutomatic

End Function

Will at least speed up picking up the array.

--
Regards,
Tom Ogilvy


"Revolvr" wrote:

Hi all,

I am trying to create a function that has a range as input. It copies the
range data into a local variable, does some manipulation, then outputs a
single value.

If the range I selected contains formulas, then the function is called, the
range recalculated, and the function called again, and so on until all cells
have been recalculated. The values in the local array are all empty, then
fill up one by one each time the function is executed. The range is a column
of cells of some arbitrary length, but long, like several thousand.

How can I prevent re-calculation each time so the function isn't called a
thousand times or more. I tried Application.Calculation = xlManual, but that
had no effect. Or is there a much better and simpler way? The reason I was
using a local array is because the data will be input to several
subroutines. The data is used but not changed by any code. The function is
called from the worksheet, not another macro.

TIA!

-- Dan

Here is the sample test code I am using:

Function ParseCompList2(rangea As Range)
Dim lrangea()
'Application.Calculate
'Application.Calculation = xlManual

iparts = rangea.Count

ReDim lrangea(1 To iparts)

For i = 1 To iparts
lrangea(i) = rangea(i, 1)
Next i
ParseCompList2 = lrangea(2)

'Application.Calculation = xlAutomatic

End Function





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Named Range references in function formulas Bob Excel Worksheet Functions 1 March 11th 08 04:21 PM
Excel2000: Reading values from range, passed to function as parameter using an expression Arvi Laanemets Excel Programming 3 April 29th 05 02:34 PM
formulas are reading weird darcerella Excel Worksheet Functions 3 December 1st 04 08:46 AM
Range.Formula in Excel 2003 gives Error reading formulas just below 1024 bytes Frank Jones Excel Programming 14 July 9th 04 06:25 AM
Protection UserInterfaceOnly reading Hidden Formulas Rik Ditter Excel Programming 1 July 12th 03 12:50 PM


All times are GMT +1. The time now is 10:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"