Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am using the following macro to list the last 4 tests but there is a slight
problem. this macro lists the last 4 tests regardless of what the mix type is and I need it to list the last 4 tests according to the mix type I call for. Sub Last_four() Dim rangeArray As Variant, r As Range rangeArray = Array("Type_Mix") For i = LBound(rangeArray) To UBound(rangeArray) If IsEmpty(Range(rangeArray(i))) Then MsgBox rangeArray(i) & " can not be blank" Exit Sub End If Next i Sheets("Last Four").Select Dim lastrow As Long Dim myrow As Long Dim mycol As Long lastrow = Sheets("test database").Cells(Rows.count, "A").End(xlUp).Row myrow = 1 mycol = 1 For i = 12 To 9 Step -1 Do Until Sheets("test database").Cells(lastrow, mycol) = "" Sheets("last four").Cells(i, mycol) = Sheets("test database").Cells(lastrow, mycol) mycol = mycol + 1 Loop lastrow = lastrow - 1 mycol = 1 Next '************** Adding up Volumetrics of Test******************** Dim cell As Range Dim rng As Range Dim counter As Long counter = 0 Set rng = Worksheets("last four").Range("AG47:AG44") For Each cell In rng If cell.Value = True Then counter = counter + 1 Else Exit For End If Next Range("AG49") = counter end sub My info is storred like this: A B C D 23 23~~ list this row 23~~ list this row 29 28 23~~ list this row 23~~ List this row I need to list the last 4 tests of #23. The macro above would list 29, 28, 23, 23, Can anyone help me out? Eric |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
excel tests | Excel Worksheet Functions | |||
mutiple tests | Excel Discussion (Misc queries) | |||
Tukey HSD tests | Excel Worksheet Functions | |||
VBA(Excel) tests | Excel Programming | |||
Average a group of tests for grade, some tests not taken by all. | Excel Discussion (Misc queries) |