当我发布以下内容时,#VALUE 会在应该报告完赛者分区排名的单元格中返回。它应该将 .Cells(lRow, 5).Value 中给出的完成者划分与所有较早完成的人进行比较,并返回适当的排名(数字 1、2 等)。
With ws
.Cells(lRow, 1).Value = Me.DTPicker1.Value 'Date/Time Stamp
.Cells(lRow, 2).Value = Me.ComboBox1.Value 'Bib Number
.Cells(lRow, 3).Value = Me.TextBox1.Value 'First Name
.Cells(lRow, 4).Value = Me.TextBox2.Value 'Last Name
.Cells(lRow, 5).Value = Me.TextBox6.Value 'Division
'Compute Division Ranking
Dim Rng As Range
Dim c As Range
Set Rng = Range(Cells(1, 5), Cells(lRow, 5))
For Each c In Rng
.Cells(lRow, 6).Value = Application.Rank(c.Value, Rng, 1)
Next c