Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Sorting data over multiple sheets into array

We have a large data set distributed across to worksheets in the same workbook.

The two sheets are named: MAK & MKW
The first observation in each sheet is located in cell B10 and ends in FZ10
the corresponding names to the data is located in cell B4 and ends in FZ4 in
both sheets.

We need to sort row 10 in ascending order and it is important that the names
are linked to their observation and finally load it into an array.

So we end up with an 2*362 array/matrix sorted according to the observations
(it is not important for us to see it explicitly in a new worksheet)

It is important that it is VBA code because we have over 400 rows.

Thank you
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 324
Default Sorting data over multiple sheets into array

Have you considered using an Access database? You would be able to set up as
many columns as needed without the hassle of having data spread over separate
datasheets.
--
Best wishes,

Jim


"The danish student" wrote:

We have a large data set distributed across to worksheets in the same workbook.

The two sheets are named: MAK & MKW
The first observation in each sheet is located in cell B10 and ends in FZ10
the corresponding names to the data is located in cell B4 and ends in FZ4 in
both sheets.

We need to sort row 10 in ascending order and it is important that the names
are linked to their observation and finally load it into an array.

So we end up with an 2*362 array/matrix sorted according to the observations
(it is not important for us to see it explicitly in a new worksheet)

It is important that it is VBA code because we have over 400 rows.

Thank you

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Sorting data over multiple sheets into array

Yes we have considered it but we need to use Excel because our data is linked
to this program.

thanks anyway

"Jim Jackson" wrote:

Have you considered using an Access database? You would be able to set up as
many columns as needed without the hassle of having data spread over separate
datasheets.
--
Best wishes,

Jim


"The danish student" wrote:

We have a large data set distributed across to worksheets in the same workbook.

The two sheets are named: MAK & MKW
The first observation in each sheet is located in cell B10 and ends in FZ10
the corresponding names to the data is located in cell B4 and ends in FZ4 in
both sheets.

We need to sort row 10 in ascending order and it is important that the names
are linked to their observation and finally load it into an array.

So we end up with an 2*362 array/matrix sorted according to the observations
(it is not important for us to see it explicitly in a new worksheet)

It is important that it is VBA code because we have over 400 rows.

Thank you

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Sorting data over multiple sheets into array

Sub SortedArray()
Dim myArray(1 To 2, 1 To 362)
Dim iCt As Integer
Dim iCt2 As Integer

Worksheets.Add After:=Worksheets(Worksheets.Count)
Sheets("MAK").Range("B4:FZ4").Copy
Range("A1").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=True
Sheets("MAK").Range("B10:FZ10").Copy
Range("B1").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=True
Sheets("MKW").Range("B4:FZ4").Copy
Range("A182").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=True
Sheets("MKW").Range("B10:FZ10").Copy
Range("B182").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=True
Range("A1:B362").Sort Key1:=Range("B1"), Order1:=xlAscending, _
Header:=xlGuess, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
For iCt = 1 To 2
For iCt2 = 1 To 362
myArray(iCt, iCt2) = Cells(iCt2, iCt)
Next iCt2
Next iCt
Application.DisplayAlerts = False
ActiveSheet.Delete
Application.DisplayAlerts = True
End Sub

Hth,
Merjet


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Sorting data over multiple sheets into array

Thank you "merjet"

It works fine.

However is it possible to incorporate a loop in this data sorting code? We
have data until row 414 and would like your sorting code to run through all
414 rows!

thanks in advance

"merjet" wrote:

Sub SortedArray()
Dim myArray(1 To 2, 1 To 362)
Dim iCt As Integer
Dim iCt2 As Integer

Worksheets.Add After:=Worksheets(Worksheets.Count)
Sheets("MAK").Range("B4:FZ4").Copy
Range("A1").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=True
Sheets("MAK").Range("B10:FZ10").Copy
Range("B1").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=True
Sheets("MKW").Range("B4:FZ4").Copy
Range("A182").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=True
Sheets("MKW").Range("B10:FZ10").Copy
Range("B182").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=True
Range("A1:B362").Sort Key1:=Range("B1"), Order1:=xlAscending, _
Header:=xlGuess, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
For iCt = 1 To 2
For iCt2 = 1 To 362
myArray(iCt, iCt2) = Cells(iCt2, iCt)
Next iCt2
Next iCt
Application.DisplayAlerts = False
ActiveSheet.Delete
Application.DisplayAlerts = True
End Sub

Hth,
Merjet





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Sorting data over multiple sheets into array

So that we finally get 400 sets of company names and data in the new sheets.

"The danish student" wrote:

Thank you "merjet"

It works fine.

However is it possible to incorporate a loop in this data sorting code? We
have data until row 414 and would like your sorting code to run through all
414 rows!

thanks in advance

"merjet" wrote:

Sub SortedArray()
Dim myArray(1 To 2, 1 To 362)
Dim iCt As Integer
Dim iCt2 As Integer

Worksheets.Add After:=Worksheets(Worksheets.Count)
Sheets("MAK").Range("B4:FZ4").Copy
Range("A1").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=True
Sheets("MAK").Range("B10:FZ10").Copy
Range("B1").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=True
Sheets("MKW").Range("B4:FZ4").Copy
Range("A182").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=True
Sheets("MKW").Range("B10:FZ10").Copy
Range("B182").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=True
Range("A1:B362").Sort Key1:=Range("B1"), Order1:=xlAscending, _
Header:=xlGuess, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
For iCt = 1 To 2
For iCt2 = 1 To 362
myArray(iCt, iCt2) = Cells(iCt2, iCt)
Next iCt2
Next iCt
Application.DisplayAlerts = False
ActiveSheet.Delete
Application.DisplayAlerts = True
End Sub

Hth,
Merjet



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Sorting data over multiple sheets into array

I don't follow. A loop to do what? Excel does the sorting on the
temporarily added sheet. You originally said you had 181 observations
on two sheets (thus 362 total). Now you say 414 or 400 observations.
Where are the extra ones? If you want to handle more observations,
adapt the hard-coded parts (worksheet names, columns, rows and array
size) of the macro I gave you. You could, of course, replace them with
variables, but you would have to give them specific values somehow.

Merjet


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
sorting multiple sheets with one button? Skeetra27 Excel Discussion (Misc queries) 1 July 29th 09 02:25 PM
help sorting multiple sheets Horatio J. Bilge, Jr. Excel Discussion (Misc queries) 7 May 21st 08 08:31 PM
Array, multiple sheets Ronny[_3_] Excel Programming 3 January 17th 06 06:43 PM
Sorting Multiple Sheets FHKBaker Excel Programming 2 January 12th 06 10:26 PM
Printing multiple sheets in an array rwong Excel Programming 3 July 28th 05 08:29 AM


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