Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hello,
i have created the following macro to filter a matrix based on a certain level. in the original matrix the values are between 1 and 5 in the different cells. the macro is filtering these values and writes in a new matrix with the same size values for the cells that are either 1 (if the brother cell's value in the original matrix is = the filter value) or 0. with the below macro code this takes ~25 minutes for a 158x158 matrix on my laptop. any idea how i can simplify the code to have it faster done? thanks, marc baumann Sub filtermatrixcom() Dim RowNdx As Integer Dim ColNdx As Integer Dim StartRow As Long Dim EndRow As Long Dim StartCol As Integer Dim EndCol As Integer Dim CellValue As String Dim PartNum As Integer Dim FilterNum As Integer PartNum = Worksheets("Participants").Range("B2").Value FilterNum = Worksheets("Control").Range("C14").Value StartRow = 2 StartCol = 2 EndRow = PartNum + 1 EndCol = PartNum + 1 Worksheets("Matrix ComF").Range("B2:IV256").Delete For RowNdx = StartRow To EndRow For ColNdx = StartCol To EndCol If Worksheets("Matrix Com").Cells(RowNdx, ColNdx).Value = FilterNum Then CellValue = 1 Else CellValue = 0 End If Worksheets("Matrix ComF").Cells(RowNdx, ColNdx).Value = CellValue Next ColNdx Next RowNdx End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Filter PivotTable dropdown items to match report filter | Excel Discussion (Misc queries) | |||
How can I transpose nXm matrix to mXn Matrix | Excel Worksheet Functions | |||
Matrix Help | Excel Worksheet Functions | |||
Matrix | Excel Discussion (Misc queries) | |||
"Criteria Range" in the "Data/Filter/Advanced Filter" to select Du | Excel Worksheet Functions |