LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Array Problem

I'm currently using an array to cycle through a set of 4 worksheets,
so that I can perform similar operations to all of them. From my
understanding, I set up the array correctly, and it works well, but it
seems to deconstruct itself in the middle of my process.

Through my own testing, I've found that the array works fine when I
first start referencing it, but during a particular For...Next Loop,
Array(x) is replaced with Empty during it's respective call in the
loop. Here's what I'm using:

Dim A As Variant
A = Array(wksht3, wksht4, wksht5, wksht6) '<-- wksht3-6 are variables
I created

'First call (intSystems is another variable set to 26 in this
instance)
For Counter = 0 To 3
With A(Counter).Range("A2:A" & intSystems)
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.MergeCells = True
End With
Next Counter

'Second Call
For Counter = 0 To 3
With A(Counter)
.Range("B2").Formula = "='Market Direction'!A2"
.Range("B2:B" & intSystems).FillDown
.Range("I2").Formula = "='Market Direction'!B2"
.Range("I2").Copy Destination:=.Range("I2:K" & intSystems)
.Range("AG2").Formula = "='Market Direction'!E2"
.Range("AG2:AG" & intSystems).FillDown
End With
Next Counter

I've figured out that my problem only occurs when I use a With block
with the array, but no modifiers. "With A(Counter)" will always set
everything to empty, but "With A(Counter).Range("A1")" will work fine.
It doesn't seem to matter what commands are called inside the block.

Does anybody have any ideas/suggestions? Also, is there a better way
for me to do operations on 4 worksheets at once?

Any help would be appreciated to get me going again.
-bgetson

 
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
VBA array problem cjsmith22[_7_] Excel Programming 5 November 13th 05 12:32 AM
Array problem: Key words-Variant Array, single-element, type mismatch error davidm Excel Programming 6 November 9th 05 05:54 AM
Array problem? Rbp9ad[_2_] Excel Programming 2 November 8th 05 07:40 PM
Array problem: Key words-Variant Array, single-element, type mismatch error davidm Excel Programming 1 November 8th 05 04:21 AM
array use problem NikkoW Excel Programming 5 May 5th 04 01:32 AM


All times are GMT +1. The time now is 08:53 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"