Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,670
Default Last 4 tests

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
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
excel tests Dave Excel Worksheet Functions 3 January 6th 11 10:25 PM
mutiple tests Mikev Excel Discussion (Misc queries) 2 March 2nd 10 02:20 PM
Tukey HSD tests Edward Excel Worksheet Functions 0 April 25th 07 01:20 PM
VBA(Excel) tests [email protected] Excel Programming 2 September 6th 06 07:55 PM
Average a group of tests for grade, some tests not taken by all. Scafidel Excel Discussion (Misc queries) 4 August 19th 05 03:50 AM


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