---Adnan: One, the range is fixed range (A1:A20)
**True.
---No, you told Gary's Student "the ranges varies (it could be A1:A5)". I'll
ignore this part until you tell me what you mean.
**Correct, ranges varies but I can set them to a fixed range since your code
does not skip blank lines and I have blanks lines.
---Adnan: This 75% should reflect or be based on quantity of titles not
number
of rows.
**Great, just what I need. But then the Yesses and Nos are being assigned a
little different. I need 75% of those titels to have Yes and the remainder No.
---Ok, but I don't know what you mean. The "quantity of titles"? In 20 rows
there are no doubt 20 titles. If the 75% figure varies with some
characteristic of the title column (which you've moved to C in the latest
example, if I'm not mistaken?), you'll have to say HOW it varies...?
**Like you said on the first post. I think we need to sort first and then
assign Yesses to 75% of those titles. Perhaps something that sums all those
qty titles, and say we have 100 of them in 60 rows, then assign Yesses to 75
of them, id does not matter what row, just cover 75% with Yes and the rest
with No.
Hre's what I did though, I added this sorting code and it looks like it
works, but the thing is now, can I restore the previous serting order?
This is the code I used, and this is the file sample:
http://cid-642741f4bfb02015.skydrive.live.com/self.aspx/Public/Bob|_s|_Help.xls
Sub RunCode()
' Sort rows first
Rows("1:20").Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("A1").Select
' Bob's code
LastRow = Sheet1.Cells(1, 1).End(xlDown).Row
SumPerson = 0
For ir = 1 To LastRow
SumPerson = SumPerson + Sheet1.Cells(ir, 1).Value
Next ir
SumPerson = SumPerson * 0.7
For ir = 1 To LastRow
If SumPerson > 0 Then vx = "Yes" Else vx = "No"
Sheet1.Cells(ir, 3) = vx
SumPerson = SumPerson - Sheet1.Cells(ir, 1)
Next ir
End Sub
Bob, I thank you for the help,
Adnan