I have a program created in 2003 and last made revisions in 2013. Unfortunately I have not been keeping up with my coding skills so need some help with taking data from an array and copying into cells in a row. Following is the code to create the array:
Private Sub cmdStartYear_Click()
Dim firstrow As Integer, lastrow As Integer, goodcol As Integer
Dim i As Integer, j As Integer, y As Integer, z As Integer, holdindex As Integer
Dim holdnumbers(7) As Integer
Worksheets("Reg_Scores").Activate
' calculate number of players
Range("B3").Select
For i = 0 To 60
If ActiveCell.Offset(i, 0).Value <> "<End Players>" Then
lastrow = (3 + i)
Else
Exit For
End If
Next
' loop through players to the last row
For j = 3 To lastrow
Range("B" & j).Select
' find first column from right with an entry
goodcol = 0
Do
For i = 31 To 3 Step -1
If Cells(j, i).Value <> "" Then
goodcol = i
Exit Do
End If
If i = 3 Then Exit Do
Next
Loop
' record valid scores into an array
holdindex = 0
For y = goodcol To 3 Step -1
If IsNumeric(Cells(j, y).Value) And Cells(j, y).Value > 0 Then
holdnumbers(holdindex) = Cells(j, y).Value
holdindex = holdindex + 1
If holdindex = 8 Then Exit For
End If
Next
' remove zeros from array if between 4 and 8 scores
'Populate Previous Year cells
'If Player does not get 4 rounds previous year they start over
If holdindex >= 4 And holdindex < 8 Then
For z = holdindex To 7
holdnumbers(z) = 1000
Next
End If
I want to copy the numbers in the holdindex to Columns C:J for each row an array is created unless there are less than 4 values.
Thanks for any help you can provide...
Bookmarks