Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 312
Default Variant Array

Hi everyone. I have a consolidate function that I'm trying to clean
up and hopefully make run faster. 2 things:

1. How can I reference an array instead of filling the array of the
consolidate function with every sheet I want to consolidate? I have
an array already created with the sheet names I want consolidated.
But when I tried to reference that in the consolidate code, it errored
out.

2. I have the range set as R5C5:R500C133. R500 is simply a big
enough area to ensure I am grabbing everything. I don't need it to be
that big, but the size will vary over time. How can I reference the
exact range rather than arbitrarily grabbing 500 rows?

Here's my code. Thanks!

Set shtarray = Sheets(Array("LMU", "Kit", "SMLC", "WLG", "SMLC Cab",
"Serv Cab", "Ntwk Kit", _
"TDAX", "EMS", "SCOUT", "Dir Coup"))

'Consolidate2
Forecast.Range("A5").Consolidate Sources:=Array( _
"'LMU'!R5C5:R500C133" _
, "'Kit'!R5C5:R500C133" _
, "'SMLC'!R5C5:R500C133" _
, "'WLG'!R5C5:R500C133" _
, "'SMLC Cab'!R5C5:R500C133" _
, "'Serv Cab'!R5C5:R500C133" _
, "'Ntwk Kit'!R5C5:R500C133" _
, "'TDAX'!R5C5:R500C133" _
, "'EMS'!R5C5:R500C133" _
, "'SCOUT'!R5C5:R500C133" _
, "'Dir Coup'!R5C5:R500C133" _
), Function:=xlSum, TopRow:=False, LeftColumn:=True,
CreateLinks:=False
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Variant Array

It's always helpful if you state what error you get rather than just saying
it "errors out".

--

Vasant

"Steph" wrote in message
m...
Hi everyone. I have a consolidate function that I'm trying to clean
up and hopefully make run faster. 2 things:

1. How can I reference an array instead of filling the array of the
consolidate function with every sheet I want to consolidate? I have
an array already created with the sheet names I want consolidated.
But when I tried to reference that in the consolidate code, it errored
out.

2. I have the range set as R5C5:R500C133. R500 is simply a big
enough area to ensure I am grabbing everything. I don't need it to be
that big, but the size will vary over time. How can I reference the
exact range rather than arbitrarily grabbing 500 rows?

Here's my code. Thanks!

Set shtarray = Sheets(Array("LMU", "Kit", "SMLC", "WLG", "SMLC Cab",
"Serv Cab", "Ntwk Kit", _
"TDAX", "EMS", "SCOUT", "Dir Coup"))

'Consolidate2
Forecast.Range("A5").Consolidate Sources:=Array( _
"'LMU'!R5C5:R500C133" _
, "'Kit'!R5C5:R500C133" _
, "'SMLC'!R5C5:R500C133" _
, "'WLG'!R5C5:R500C133" _
, "'SMLC Cab'!R5C5:R500C133" _
, "'Serv Cab'!R5C5:R500C133" _
, "'Ntwk Kit'!R5C5:R500C133" _
, "'TDAX'!R5C5:R500C133" _
, "'EMS'!R5C5:R500C133" _
, "'SCOUT'!R5C5:R500C133" _
, "'Dir Coup'!R5C5:R500C133" _
), Function:=xlSum, TopRow:=False, LeftColumn:=True,
CreateLinks:=False



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
Best way to paste a variant array into a range? AnneB Excel Programming 2 April 28th 04 09:57 PM
Variant Array with String Values - Type Mismatch jamiee Excel Programming 2 March 7th 04 03:39 AM
basic variant to array conversion Jeff Sward Excel Programming 1 January 26th 04 07:59 PM
Asign Array Variant to Column William C. Smith Excel Programming 3 December 27th 03 04:20 AM
variant array containing cel adresses convert to actual ranges-array Peter[_21_] Excel Programming 5 December 10th 03 09:50 PM


All times are GMT +1. The time now is 07:52 AM.

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

About Us

"It's about Microsoft Excel"