Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default Creating and transposing a multiarray

I have some code that will filter a table in excel on two factors, sum the
visible rows in a particular column, store the sums in a 2 dimensional array
and transpose the array to another workbook. I believe the array is being
created properly; however, it does not transpose correct. Here is the code.
Any help would be appreciated.

Dim iCalWeek As Integer ' Variable for calendar week number
Dim iRow As Integer ' Row variable for array
Dim iCol As Integer ' Column variable for array
Dim wsTop8DC As Worksheet ' Variable for Top 8 Worksheet
Dim tblTop8DC As ListObject ' Variable for Top 8 Defect Count
' 2 dim array to hold Loop 4 count on 8 issues for past 7 calendar weeks
Dim iLoop4Totals(1 To 7, 1 To 8) As Integer

' Set iCalWeek to 8 weeks before current week
iCalWeek = WorksheetFunction.WeekNum(Date) - 8
Set wsTop8DC = Workbooks("Tables").Sheets("Top8DefectCount")
Set tblTop8DC = wsTop8DC.ListObjects("tblTop8DC")

For iRow = 1 To 7
With tblTop8DC
.Range.AutoFilter Field:=7 ' Clear Filter
' Filter table based on calendar week
.Range.AutoFilter Field:=7, Criteria1:=(iCalWeek + iRow)
End With

For iCol = 1 To 8
With tblTop8DC
.Range.AutoFilter Field:=3 ' Clear Filter
' Filter table based on issue number
.Range.AutoFilter Field:=3, Criteria1:=iCol
End With
With wsTop8DC
' Set array value to sum of issues occurance
iLoop4Totals(iRow, iCol) = _

WorksheetFunction.Sum(.Range("F:F").SpecialCells(x lCellTypeVisible))
End With
Next
Next
' Transpose Array
With Workbooks("Top8Slides").Sheets("Data")
.Range("B4:I10") = WorksheetFunction.Transpose(iLoop4Totals)
End With
  #2   Report Post  
Posted to microsoft.public.excel.programming
KC KC is offline
external usenet poster
 
Posts: 55
Default Creating and transposing a multiarray

May be
..range("B4:H11") = WorksheetFunction.Transpose(iLoop4Totals)

"Brad" wrote in message
...
I have some code that will filter a table in excel on two factors, sum the
visible rows in a particular column, store the sums in a 2 dimensional
array
and transpose the array to another workbook. I believe the array is being
created properly; however, it does not transpose correct. Here is the
code.
Any help would be appreciated.

Dim iCalWeek As Integer ' Variable for calendar week number
Dim iRow As Integer ' Row variable for array
Dim iCol As Integer ' Column variable for array
Dim wsTop8DC As Worksheet ' Variable for Top 8 Worksheet
Dim tblTop8DC As ListObject ' Variable for Top 8 Defect Count
' 2 dim array to hold Loop 4 count on 8 issues for past 7 calendar weeks
Dim iLoop4Totals(1 To 7, 1 To 8) As Integer

' Set iCalWeek to 8 weeks before current week
iCalWeek = WorksheetFunction.WeekNum(Date) - 8
Set wsTop8DC = Workbooks("Tables").Sheets("Top8DefectCount")
Set tblTop8DC = wsTop8DC.ListObjects("tblTop8DC")

For iRow = 1 To 7
With tblTop8DC
.Range.AutoFilter Field:=7 ' Clear Filter
' Filter table based on calendar week
.Range.AutoFilter Field:=7, Criteria1:=(iCalWeek + iRow)
End With

For iCol = 1 To 8
With tblTop8DC
.Range.AutoFilter Field:=3 ' Clear Filter
' Filter table based on issue number
.Range.AutoFilter Field:=3, Criteria1:=iCol
End With
With wsTop8DC
' Set array value to sum of issues occurance
iLoop4Totals(iRow, iCol) = _

WorksheetFunction.Sum(.Range("F:F").SpecialCells(x lCellTypeVisible))
End With
Next
Next
' Transpose Array
With Workbooks("Top8Slides").Sheets("Data")
.Range("B4:I10") = WorksheetFunction.Transpose(iLoop4Totals)
End With



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Creating and transposing a multiarray

Dear Brad

I did not test this but after transposing the range should be B4:H11 instead
of B4:I10. Please try and feedback.

..Range("B4:H11") = WorksheetFunction.Transpose(iLoop4Totals)

If this post helps click Yes
--------------
Jacob Skaria

"Brad" wrote:

I have some code that will filter a table in excel on two factors, sum the
visible rows in a particular column, store the sums in a 2 dimensional array
and transpose the array to another workbook. I believe the array is being
created properly; however, it does not transpose correct. Here is the code.
Any help would be appreciated.

Dim iCalWeek As Integer ' Variable for calendar week number
Dim iRow As Integer ' Row variable for array
Dim iCol As Integer ' Column variable for array
Dim wsTop8DC As Worksheet ' Variable for Top 8 Worksheet
Dim tblTop8DC As ListObject ' Variable for Top 8 Defect Count
' 2 dim array to hold Loop 4 count on 8 issues for past 7 calendar weeks
Dim iLoop4Totals(1 To 7, 1 To 8) As Integer

' Set iCalWeek to 8 weeks before current week
iCalWeek = WorksheetFunction.WeekNum(Date) - 8
Set wsTop8DC = Workbooks("Tables").Sheets("Top8DefectCount")
Set tblTop8DC = wsTop8DC.ListObjects("tblTop8DC")

For iRow = 1 To 7
With tblTop8DC
.Range.AutoFilter Field:=7 ' Clear Filter
' Filter table based on calendar week
.Range.AutoFilter Field:=7, Criteria1:=(iCalWeek + iRow)
End With

For iCol = 1 To 8
With tblTop8DC
.Range.AutoFilter Field:=3 ' Clear Filter
' Filter table based on issue number
.Range.AutoFilter Field:=3, Criteria1:=iCol
End With
With wsTop8DC
' Set array value to sum of issues occurance
iLoop4Totals(iRow, iCol) = _

WorksheetFunction.Sum(.Range("F:F").SpecialCells(x lCellTypeVisible))
End With
Next
Next
' Transpose Array
With Workbooks("Top8Slides").Sheets("Data")
.Range("B4:I10") = WorksheetFunction.Transpose(iLoop4Totals)
End With

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default Creating and transposing a multiarray

Actually it was
..Range("B4:H10) = WorksheetFunction.Transpose(iLoop4Totals)

With H11 I got an extra row of 0's.

Thanks so much for the help. Couldn't have figured it out without it.

"Jacob Skaria" wrote:

Dear Brad

I did not test this but after transposing the range should be B4:H11 instead
of B4:I10. Please try and feedback.

.Range("B4:H11") = WorksheetFunction.Transpose(iLoop4Totals)

If this post helps click Yes
--------------
Jacob Skaria

"Brad" wrote:

I have some code that will filter a table in excel on two factors, sum the
visible rows in a particular column, store the sums in a 2 dimensional array
and transpose the array to another workbook. I believe the array is being
created properly; however, it does not transpose correct. Here is the code.
Any help would be appreciated.

Dim iCalWeek As Integer ' Variable for calendar week number
Dim iRow As Integer ' Row variable for array
Dim iCol As Integer ' Column variable for array
Dim wsTop8DC As Worksheet ' Variable for Top 8 Worksheet
Dim tblTop8DC As ListObject ' Variable for Top 8 Defect Count
' 2 dim array to hold Loop 4 count on 8 issues for past 7 calendar weeks
Dim iLoop4Totals(1 To 7, 1 To 8) As Integer

' Set iCalWeek to 8 weeks before current week
iCalWeek = WorksheetFunction.WeekNum(Date) - 8
Set wsTop8DC = Workbooks("Tables").Sheets("Top8DefectCount")
Set tblTop8DC = wsTop8DC.ListObjects("tblTop8DC")

For iRow = 1 To 7
With tblTop8DC
.Range.AutoFilter Field:=7 ' Clear Filter
' Filter table based on calendar week
.Range.AutoFilter Field:=7, Criteria1:=(iCalWeek + iRow)
End With

For iCol = 1 To 8
With tblTop8DC
.Range.AutoFilter Field:=3 ' Clear Filter
' Filter table based on issue number
.Range.AutoFilter Field:=3, Criteria1:=iCol
End With
With wsTop8DC
' Set array value to sum of issues occurance
iLoop4Totals(iRow, iCol) = _

WorksheetFunction.Sum(.Range("F:F").SpecialCells(x lCellTypeVisible))
End With
Next
Next
' Transpose Array
With Workbooks("Top8Slides").Sheets("Data")
.Range("B4:I10") = WorksheetFunction.Transpose(iLoop4Totals)
End With

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
Transposing gary Excel Programming 2 July 22nd 08 04:47 PM
Transposing Nanapat Excel Discussion (Misc queries) 2 April 2nd 08 11:38 PM
redim multiarray ranswert Excel Programming 3 March 24th 08 10:30 PM
TRANSPOSING GARY Excel Discussion (Misc queries) 1 March 17th 06 11:09 AM
transposing and creating new rows krove Excel Programming 4 October 21st 05 07:51 PM


All times are GMT +1. The time now is 01:30 PM.

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"