LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default more array help needed

I'm notr sure what you are trying to do but I have written macros that merge
worksheets togeter where the rows and columns are different. I don't use
arrays to accomplish this task. Instead I use the find function. Below is a
summary of the code I use. This code is not tested. I just used to show an
example of what I usually do. the coe need to be adjusted depending on the
number of sheets yo are adding to the mater worksheet.

Using VBA functions like the FIND Method is sometimes quicker than working
with arrays in VBA. sorting and searching using VBA code is usally slower
that using stand methods and function methods that microsoft optimized. The
optimized code (like FIND) has been run through compilers that are designed
to make the code run quickly. The VBA code isn't optimized the same way
which makes the code run slower.

1) Start with blank worksheet which I use as a master worksheet. then
repeat this process for each worksheet/workbook I want to add to the master
sheet.

2) Each worksheet I add has an ID row in column A and a set of headers in
row 1.

3) I use two for loop to span each new worksheet I add to the master

NewRow = 2
NewCol = 2
For ColCount = 2 to LastColumn
ColumnHeader = cells(1,Colcount)
'check if header exists in master sheet
set c = MasterSht.Rows(1).find(what:=ColHeader)
if c is nothing then
AddCol = NewCol
NewCol = Newcol + 1
else
AddCol = c.column
end if
for RowCount = 2 to Lastrow
RowHeader = Range("A" & RowCount)
'check if header exists in master sheet
set c = MasterSht.Columns("A").find(what:=RowHeader)
if c is nothing then
AddRow = NewRow
NewRow = NewRow + 1
else
AddRow = c.column
end if

MasterSht.Cells(AddRow, AddCol) = Range(RowCount,ColCount)

next RowCount
NextColCount
"needhelp" wrote:

thanks to Par Jessen I can now populate my arrays (previous
question)... however i have another issue with another array.

The array is dynamic (single dimension).

Each array element is the count of cells
e.g.
numpkfrows(1) = 216
numpkfrows(2) = 219
numpkfrows(3) = 216
....numpkfrows(n)

i now need to determine if all of the values of the array elements are
the same (so in the above example I would want an error thrown).

(hope this makes sense)

What would be the easiest way to compare all of the elements within
the array?

Cheers
Julie


 
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
running sum needed with #N/A in array Lois Excel Discussion (Misc queries) 4 January 22nd 09 10:39 PM
array help needed Rivers Excel Programming 6 November 3rd 08 03:05 AM
Possible Array Solution Needed? [email protected] Excel Discussion (Misc queries) 2 July 7th 08 03:31 PM
Maybe an array is needed? Arturo Excel Worksheet Functions 1 September 6th 06 01:26 PM
Array Help Needed Gav !![_2_] Excel Programming 2 October 26th 03 07:39 PM


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