N
Nate
I've got the code below that loops through a range of cells fills in
some information for a tournament, including assigning a unique code
for a section judge (i.e. J-AB1). Everything works great, except that
it's extremely slow. I tested the speed of each line of code using a
stopwatch sub that others have posted. Each line runs between 0-4
milliseconds except the line: JdgCell = "J-" & c & i which runs
upward of 320 milliseconds. All it's doing is changing the value of a
cell so I don't understand what the holdup is. I'm using almost the
exact same code in another part of the program and it runs fast. Any
ideas?
Thanks! Nate
For Each c In SCodes
With c.Offset(, 16)
If .Value > 0 Then 'check if number of judges > 0
For i = 1 To .Value
Set JdgCell = JdgCell.Offset(1)
'fill in school code
JdgCell.Offset(, -2) = c.Text
'fill in school name
JdgCell.Offset(, -1) = c.Offset(, 1).Text
'fill in judge code
JdgCell = "J-" & c & i <---- this line is taking
300+ milliseconds to execute
Next i
End If
End With
Next c
some information for a tournament, including assigning a unique code
for a section judge (i.e. J-AB1). Everything works great, except that
it's extremely slow. I tested the speed of each line of code using a
stopwatch sub that others have posted. Each line runs between 0-4
milliseconds except the line: JdgCell = "J-" & c & i which runs
upward of 320 milliseconds. All it's doing is changing the value of a
cell so I don't understand what the holdup is. I'm using almost the
exact same code in another part of the program and it runs fast. Any
ideas?
Thanks! Nate
For Each c In SCodes
With c.Offset(, 16)
If .Value > 0 Then 'check if number of judges > 0
For i = 1 To .Value
Set JdgCell = JdgCell.Offset(1)
'fill in school code
JdgCell.Offset(, -2) = c.Text
'fill in school name
JdgCell.Offset(, -1) = c.Offset(, 1).Text
'fill in judge code
JdgCell = "J-" & c & i <---- this line is taking
300+ milliseconds to execute
Next i
End If
End With
Next c