0

当我发布以下内容时,#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
4

1 回答 1

0

只是在黑暗中拍摄:

   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 = CLng(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
于 2013-09-23T21:11:21.530 回答